Just try the following example: ${scroll 10 Zażółcić gęślą jaźń}. The string should be encoded as UTF-8. Conky displays it ok without a scroll, but with it seems to shift string by a single byte instead of by single character. Conky tries to display a half of a character which leads to undesired shift of all text. In result Conky window blinks.
conky config
[PATCH] Make scroll UTF-8 aware. Fixes bug #3134941.
I would like to confirm that I am also seeing this behavior, and it is quite annoying.
I can confirm this as well.
Using Conky 1.9.0.
The patch provided by aidecoe works perfectly.
Ok, so it seems that after applying the patch, conky has started hanging sometimes when scrolling.
After extensive experimenting, I found that for certain values of scroll (and step?), some text with a certain length, makes conky hang.
for example,
and a text of 56 characters made conky hang.
While the following worked fine:
Last edit: oss-adv 2013-09-26
OK, I've figured out why the patched scroll.cc tends to hang.
It's due to an infinite while loop, more exactly this bit:
--
Function
utf8_charlen()
would (previously) return a -1 once len was outside the[1;4]
interval, and this is where the trouble begins:j += charlen
.j is checked in the loop whether its value exceeds the sum (
sd->show + visibcolorchanges + utf8lenfix
). But charlen may get NEGATIVE and cause j to start counting backwards!! In this case, while loop is never exited - hence the hang.I "fixed" it by extending the VALID length from 4 to MAXLEN in function
utf8_charlen()
:(original)
(new)
You probably guessed it: every time the length value exceeded MAXLEN, it returned -1 and messed up the while loop.
Besides, while debugging quite a lot of those previously "problematic" foreign strings, I've never encountered any length greater than MAXLEN (so far).
Last edit: Andreas E 2015-08-07
Surprise! ;-) Nothing gets lost in my mailbox.
Thank you for investigating the issue. You are right, 4 is incorrect, but as far as I read 6 is actually the maximum. In this case the first byte is 1111110x. Anything more than 6 wouldn't make sense. Do you agree with me?
I have attached the patch (for 1.9.1 branch) with fix as mentiond above.
Last edit: aidecoe 2015-08-08