alacritty: Alacritty sometimes fails to invert cursor color (e.g. black cursor in vim with dark colorscheme)

System

OS: Arch Linux Version: alacritty 0.5.0 Sway WM, Wayland. Alacritty Config: https://github.com/alexryndin/dotfiles/blob/7cc014348e758edc56b6e7c4e37213ec89a61171/.config/alacritty/alacritty.yml

Steps to reproduce:

  1. Launch Alacritty with white background and black cursor config:
$ alacritty --config-file <(echo "colors:
  primary:
        foreground: '0x000000'
        background: '0xeeeeee'
")
  1. In a new terminal window, launch nvim with no plugins enabled: nvim -u NONE
  2. In nvim, set dark colorscheme, elflord for instance:
set termguicolors
colorscheme elflord

Type something and then put cursor on second line: type: itesttest<esc>o grim-28 09 2020-215259 Cursor is on the second line now, but it’s dark and barely visible.

Additional info: I prefer white and black colorscheme in alacritty, but I use dark scheme (gruvbox) in vim. It looks good outside vim: grim-27 09 2020-180138 But cursor color fails to match vim’s colorscheme (cursor is on line 2): grim-27 09 2020-180400 Compare to gnome-terminal: grim-27 09 2020-180511 This is actually very strange behavior, cursor becomes white if it is below non-empty line: grim-27 09 2020-190513 But it becomes black if it is above non-empty line: grim-27 09 2020-190506

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 1
  • Comments: 28 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I use onedark theme in neovim encounter this issue, reproduce steps:

  1. alacritty --config-file reproduce.yml
  2. echo -ne '\e[38;2;0;0;0m\e[48;2;229;192;123m\a\e[K'; sleep infinity
  3. echo -ne '\e[38;2;0;0;0m\e[48;2;209;154;102m\a\e[K'; sleep infinity

cat reproduce.yml

colors:
  primary:
    background: '#202326'
    foreground: '#abb2bf'
  cursor:
   text: '#000000'
   cursor: '#528bff'

image


image

https://github.com/alacritty/alacritty/pull/4311 don’t work for my issue.

A minimal repro would provide just the escape sequences necessary to create this problem. @kchibisov was already looking into this using the ref test, so that should hopefully be sufficient.

@chrisduerr it seems like that’s the reproducer. It’s pretty strange, I do remember checking for such things in the past and we were behaving the same with xterm, however maybe not all ‘clearing’ escapes should do that with ‘only bg’ template? Underlines, etc are also not cleared afaics.

echo -ne "\e[38;2;0;255;255m\e[48;2;0;0;0m\a\e[K";sleep 10

I feel like they preserve foreground color? Not sure about flags, they unlikely preserve that, and I do remember testeing for such things i nthe past, however I don’t remember If we actually verified foreground color…

Try TERM=xterm-256color nvim