neovim icon indicating copy to clipboard operation
neovim copied to clipboard

underline has a wrong colour if the text is overlayed by a transparent floating window

Open elianiva opened this issue 3 years ago • 4 comments

  • nvim --version: NVIM v0.5.0-dev+1281-gecf075eb2
  • vim -u DEFAULTS (version: ) behaves differently? does not have nvim_open_win and winblend
  • Operating system/version: Archlinux
  • Terminal name/version: kitty 0.20.2
  • $TERM: xterm-kitty

Steps to reproduce using nvim -u NORC

use this file.lua and observe the underline.

nvim -u NORC file.lua

The first line is overlayed by a transparent floating window, the second one is not.

Actual behaviour

image

Expected behaviour

image


Maybe it's because xterm-kitty has the ability to use a different underline colour so it changed to red, while xterm-256color does not, the underline has the same colour as the text regardless of the setting. This only happens when the text is below a floating window with winblend=100.

One of the solutions is changing the guisp manually to a colour I want but that doesn't seem good, ideally it should not change to red when it's overlayed by a floating window. The other solution is changing my $TERM to xterm-256color but I'd lose the capability of changing the underline colour which is useful for LSP diagnostics.

Thanks in advance!

elianiva avatar Apr 28 '21 13:04 elianiva

we should ignore the guisp of the float unless it has underline or undercurl set.

bfredl avatar Apr 28 '21 14:04 bfredl

This bug is still existed in latest commit. Who can fix it? Thanks.

adoyle-h avatar Sep 22 '22 09:09 adoyle-h

Maybe you?

clason avatar Sep 22 '22 09:09 clason

This bug is only present if the background underline highlight group doesn't have a guisp.

Also, this seems to fix the problem:

diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 305e84276..ffadfbb02 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -610,7 +610,7 @@ static HlAttrs get_colors_force(int attr)
     attrs.rgb_fg_color = normal_fg;
   }
   if (attrs.rgb_sp_color == -1) {
-    attrs.rgb_sp_color = normal_sp;
+    attrs.rgb_sp_color = normal_sp != -1 ? normal_sp : attrs.rgb_fg_color;
   }
   HL_SET_DEFAULT_COLORS(attrs.rgb_fg_color, attrs.rgb_bg_color,
                         attrs.rgb_sp_color);

Looks a bit hacky though.

zeertzjq avatar Mar 12 '23 06:03 zeertzjq