Hello, I was seeing artifacting over text input when using an NPM TUI that was drawing zero-width spaces (U+200B) over the input as some kind of cursor rendering trick. The outline of the placeholder glyph would display repeatedly as a ghost outline, not disappearing until I resized the window to force a redraw.
It seems like the rxvt_font_default::draw() method handles zero-width characters by just skipping them, so I applied this to the _xft and _x11 versions as well, which appears to have fixed the issue (my font is xft:Unifont:pixelsize=24). Screenshots of the terminal before/after the patch: Before: https://www.xvjpf.org/rxvt_zwsp_before.png After: https://www.xvjpf.org/rxvt_zwsp_after.png Hopefully this patch (appended) is generally useful. Best, - Ross -- diff --git a/src/rxvtfont.C b/src/rxvtfont.C index 2a36e96..8e4ae8b 100644 --- a/src/rxvtfont.C +++ b/src/rxvtfont.C @@ -1064,6 +1064,10 @@ rxvt_font_x11::draw (rxvt_drawable &d, int x, int y, int base = ascent; // sorry, incorrect: term->fbase; + // skip zero-width characters to avoid rendering artifacts with background colors + while (len && *text == ZERO_WIDTH_CHAR) + text++, len--; + XGCValues v; v.foreground = term->pix_colors[fg]; v.font = f->fid; @@ -1452,6 +1456,10 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, while (len && *text == NOCHAR) text++, len--, cwidth += term->fwidth; + if (chr == ZERO_WIDTH_CHAR) + // skip zero-width characters to avoid rendering artifacts with background colors + continue; + if (chr != ' ') // skip spaces { // handle non-bmp chars when text_t is 16 bit
_______________________________________________ rxvt-unicode mailing list [email protected] http://lists.schmorp.de/mailman/listinfo/rxvt-unicode
