drw.c: use the same pattern as ellipsis_width to check for infinite recursion

ref.
https://git.suckless.org/dmenu/commit/475d8093cb8d29d5756937bfa9e0b3b9e415f632.html
This commit is contained in:
bakkeby 2024-07-18 09:59:32 +02:00
parent b980b0a359
commit 3b547d5263
2 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this dmenu 5.3 (7be720c, Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this dmenu 5.3 (475d809,
2024-03-19) project has a different take on patching. It uses preprocessor directives to decide 2024-07-14) project has a different take on patching. It uses preprocessor directives to decide
whether or not to include a patch during build time. Essentially this means that this build, for whether or not to include a patch during build time. Essentially this means that this build, for
better or worse, contains both the patched _and_ the original code. The aim being that you can better or worse, contains both the patched _and_ the original code. The aim being that you can
select which patches to include and the build will contain that code and nothing more. select which patches to include and the build will contain that code and nothing more.

4
drw.c
View File

@ -469,10 +469,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
usedfont = drw->fonts; usedfont = drw->fonts;
if (!ellipsis_width && render) if (!ellipsis_width && render)
ellipsis_width = drw_fontset_getwidth(drw, ellipsis); ellipsis_width = drw_fontset_getwidth(drw, ellipsis);
if (!invalid_width) { if (!invalid_width && render)
invalid_width = -1; /* stop infinite recursion */
invalid_width = drw_fontset_getwidth(drw, invalid); invalid_width = drw_fontset_getwidth(drw, invalid);
}
while (1) { while (1) {
ew = ellipsis_len = utf8err = utf8strlen = 0; ew = ellipsis_len = utf8err = utf8strlen = 0;
utf8str = text; utf8str = text;