alacritty: alacritty does not draw background color for (some) invisible characters
For example in htop.
Easily visible in this command:
yes "$(seq 16 231)" | while read i; do printf "\x1b[48;5;${i}m\n"; sleep .02; done
because it is entirely invisible in alacritty, but visible in other terminal emulators
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 41 (12 by maintainers)
Commits related to this issue
- Fix issue with htop rendering incorrectly Since we're emulating xterm, we need to support back_color_erase. If this is found to cause any issues, please open a ticket on GitHub. Resolves #85. — committed to alacritty/alacritty by jwilm 7 years ago
- Fix issue with htop rendering incorrectly Since we're emulating xterm, we need to support back_color_erase. If this is found to cause any issues, please open a ticket on GitHub. Resolves #85. — committed to alacritty/alacritty by jwilm 7 years ago
- Fix issue with htop rendering incorrectly Since we're emulating xterm, we need to support back_color_erase. If this is found to cause any issues, please open a ticket on GitHub. Resolves #85. — committed to alacritty/alacritty by jwilm 7 years ago
- Fix issue with htop rendering incorrectly Since we're emulating xterm, we need to support back_color_erase. If this is found to cause any issues, please open a ticket on GitHub. Resolves #85. — committed to munyari/alacritty by jwilm 7 years ago
- Fix issue with htop rendering incorrectly Since we're emulating xterm, we need to support back_color_erase. If this is found to cause any issues, please open a ticket on GitHub. Resolves #85. — committed to chrisduerr/alacritty by jwilm 7 years ago
Thanks for the report! This should be relatively easy to fix as soon as I can make some time.
I’ve found a case with vim, that might be related to this or something completely different. Having default config for alacritty master and using vim with gruvbox dark theme I see black backgrounds when scrolling with
j
/k
@jwilm I think both are right after doing some research (or at least can be right). Its called background-color-erase, its something a terminal can support or not support via the bce setting. I don’t think alacritty ships and uses its own termcap file yet and is piggybacking off whatever TERM is set to. If TERM=xterm-256 color then bce is enabled . So when htop renders it thinks that erasing to the end of the line will have the currently set background color. We don’t see the problem in tmux or without tmux but TERM=tmux-256color, because it does not set bce in the terminfo. This results in htop not trying to draw line with erase to the end of the line.
And for tmux-256 color
So if the goal is be a xterm compatible / replacement then I think it should use the template, if not then ship a terminfo and use that (not setting bce). At some point the main documentation should be updated specifying what TERM= to use when using alacritty.
An empty cell is actually populated with
' '
and the default colour:So the problem I guess is that white space characters (‘\n’, ‘\t’, …)don’t update the relevant cells with a colour update
Here is a gif of me moving around in vim a little bit and adding some text. Hopefully this helps to visualise the issue a little more.
I’m not too sure what invisible character (if any) vim tries to render when there is no text in a region, but maybe it might differentiate from the example given in the issue description?
Whoops - my bad! I didn’t realise I had to do that for each new terminal window.
Unfortunately this seems to have introduced a weird visual glitch and may have introduced a crash. Either that or made an existing crash more visible.
On the plus side it does seem to have fixed the case given by @d3rrial.
Issues: 1.) If I run @d3rrial’s example but then press
ctrl+c
to exit it the terminal crashes with this error:2.) My vim now seems to be quite broken. Here is a gif:![](http://g.recordit.co/rsihhPhSQj.gif)
EDIT: As something a little extra - here is a gif of the original example working - but then crashing when pressing
ctrl+c
I can confirm what @d3rrial has described. I tried to comment out the is_empty code and the issue still persists.
I think if you have a theme like gruvbox in vim that isn’t rendering properly the problem becomes a little bit more interactive / visible. It seems that you just simply can’t “reach” these characters that aren’t being rendered.
I’ll try and record a gif or a video to demonstrate or maybe try to print out the on the screen what characters are in the empty space.
The problem seems to be elsewhere. I completely commented out the skipping code in term.rs but the output still looks exactly the same, so this issue is either not related to blank characters, or it’s located elsewhere in the code.
The logic for when to skip a cell is in term.rs. It uses
Cell::is_empty()
for checking if the cell should normally be displayed. Theis_empty()
logic should be updated for other non-printable characters.Edit: perhaps using https://doc.rust-lang.org/std/primitive.char.html#method.is_whitespace