mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
scroll: compatibility fix wrt upstream utf8decode overhaul changes #33
This commit is contained in:
parent
23cbc819b9
commit
43f0483d5a
@ -25,6 +25,7 @@ drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const cha
|
||||
FcPattern *match;
|
||||
XftResult result;
|
||||
int charexists = 0;
|
||||
int utf8err = 0;
|
||||
int i, n;
|
||||
|
||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts || textlen <= 0
|
||||
@ -56,14 +57,14 @@ drw_text_align(Drw *drw, int x, int y, unsigned int w, unsigned int h, const cha
|
||||
|
||||
while ((align == AlignL && i < textlen) || (align == AlignR && i > 0)) {
|
||||
if (align == AlignL) {
|
||||
utf8charlen = utf8decode(text + i, &utf8codepoint, MIN(textlen - i, UTF_SIZ));
|
||||
utf8charlen = utf8decode(text + i, &utf8codepoint, &utf8err);
|
||||
if (!utf8charlen) {
|
||||
textlen = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
n = utf8nextchar(text, textlen, i, -1);
|
||||
utf8charlen = utf8decode(text + n, &utf8codepoint, MIN(textlen - n, UTF_SIZ));
|
||||
utf8charlen = utf8decode(text + n, &utf8codepoint, &utf8err);
|
||||
if (!utf8charlen) {
|
||||
textlen -= i;
|
||||
text += i;
|
||||
|
Loading…
Reference in New Issue
Block a user