Writing a colored character into a gap created by \t recolors the entire gap

Oleg A.P. urxlist at dev-random.ru
Wed Mar 25 15:53:19 CET 2020


A script that reproduces the bug:

```
#!/bin/bash

# the bug sometimes fails to reproduce if the tty is not empty:
reset

# set color:
echo -n $'\033[44m'

# move into the position:
echo -n $'\033[5;43H'
sleep 1

# display a gap surrounded by 2 colored characters:
echo -n '.'
sleep 1
echo -n $'\t'
sleep 1
echo -n '.'
sleep 1

# move the cursor into the gap. Notice how ridiculously wide the cursor
# becomes.
echo -n $'\033[5;44H'
sleep 1

# display a colored character in the gap. Notice how the entire gap
# changes color.
echo -n '.'
sleep 1
```

This behavor does not match other terminals and is not expected by 
NCurses. The conditions for the bug are rather rare but they do happen.

For example, if an application displays a menu as a 2-column table with 
the right column starting at a tab stop, and only highlights the left 
column (+ 1 space around it) of the focused line but not the right one, 
this often makes the focus leave garbage between columns in its wake.

NCurses first draws the line unfocused, skipping over the gap using 
tabs, then redraws the left column and the first space in the gap with 
the focused colors (making urxvt unexpectedly recolor the gap), and 
then, as the focus moves on, redraws it again uncolored, but this time 
around that first space of the gap is not longer part of the tabulation 
and does not repeat the bug, leaving the gap still colored as though 
it's focused.




More information about the rxvt-unicode mailing list