Hello.

I've been having a problem with only half of some wide characters being drawn
when the cursor is over them. See screenshot:

http://i.imgur.com/eTCiVad.png

String used for reproducing can be found here:

http://pastebin.com/xSgMma7d

Steps to reproduce are:

1. paste above string into terminal;
2. move cursor into the first of the two characters.


I found the culprit to be the careful character handling in
rxvt_term::scr_refresh(), line 2392 in screen.C in rev 1.432.

If I understand the code correctly, the problem is that if the cursor is over a
careful character and the one after it is also careful, when looking for
previous careful characters from the one after the cursor, the second text_t in
the cursor character tests true for having the same rendition as the following
character, but the first text_t tests false, causing text to point to the
second text_t by the end (that is, halfway through the cursor character), which
then causes rxvt_font_xft::draw() to try to draw a NOCHAR, thus erasing half
the cursor character previously drawn.

The attached workaround fixes it for me, but I don't think I understand
enough to know what the best, most correct fix would be. I'd appreciate
it if someone more familiar with the code could look into it.

Cheers.
diff -dru5 rxvt-unicode.orig/src/screen.C rxvt-unicode/src/screen.C
--- rxvt-unicode.orig/src/screen.C      2013-01-13 20:30:47.000000000 -0200
+++ rxvt-unicode/src/screen.C   2013-01-29 18:22:34.213981148 -0200
@@ -2394,10 +2394,13 @@
               // include previous careful character(s) if possible, looks 
nicer (best effort...)
               while (text > stp
                   && srp[text - stp - 1] & RS_Careful
                   && RS_SAME (rend, srp[text - stp - 1]))
                 text--, count++, xpixel -= fwidth;
+              // undo last step if we have landed in the middle of a wide char
+              if (text[0] == NOCHAR)
+                text++, count--, xpixel += fwidth;
 
               // force redraw after "careful" characters to avoid pixel 
droppings
               for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; 
i++)
                 drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw;
 
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to