Underline color is being overwritten by foreground color #21628

Closed
opened 2026-01-31 07:50:08 +00:00 by claunia · 4 comments
Owner

Originally created by @EpicBirb on GitHub (May 2, 2024).

Windows Terminal version

1.19.10821.0

Windows build number

10.0.19045.0

Other Software

nvim v0.9.5

Steps to reproduce

  1. Create the following highlight group in neovim using this command :lua vim.api.nvim_set_hl(0, "test", {underline=true, sp="#00FF00", fg="#FFFFFF"})
  2. Then run the command :hi test

Expected Behavior

image
Executed using nvim-qt

Actual Behavior

image
Executed using Terminal

Originally created by @EpicBirb on GitHub (May 2, 2024). ### Windows Terminal version 1.19.10821.0 ### Windows build number 10.0.19045.0 ### Other Software nvim v0.9.5 ### Steps to reproduce 1. Create the following highlight group in neovim using this command `:lua vim.api.nvim_set_hl(0, "test", {underline=true, sp="#00FF00", fg="#FFFFFF"})` 2. Then run the command `:hi test` ### Expected Behavior ![image](https://github.com/microsoft/terminal/assets/68750348/c8d9ff06-ff3b-440d-9fe6-a41892c55bea) Executed using nvim-qt ### Actual Behavior ![image](https://github.com/microsoft/terminal/assets/68750348/237f3fc3-c40f-4fbf-8b6e-6793dd8baddc) Executed using Terminal
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 07:50:08 +00:00
Author
Owner

@PhMajerus commented on GitHub (May 2, 2024):

Doesn't seem to be a problem in Terminal itself, I can have colored underlines and change the foreground color without it affecting the underline color:
image

@PhMajerus commented on GitHub (May 2, 2024): Doesn't seem to be a problem in Terminal itself, I can have colored underlines and change the foreground color without it affecting the underline color: ![image](https://github.com/microsoft/terminal/assets/25664275/74741b51-5e65-4288-968b-d96a3eecc3f2)
Author
Owner

@lhecker commented on GitHub (May 3, 2024):

It's because neovim only enables extended and colored underlines if the terminfo database says so, as well as for certain specific terminals: 01e4a70d66/src/nvim/tui/tui.c (L2365-L2375)

While invisible-island.net does an absolutely fantastic job in maintaining the terminfo database overall, when it comes to Windows Terminal it's not quite perfect:

  • Since we're still "catching up" with the other established terminals, the terminfo database is usually behind by a year or so of our development (currently: 1.16 from Jan 2023).
  • It has some remarks about our correctness that I personally find very surprising. Among others it says "italics sitm/ritm do not work in WSL2" even though that's \e[3m and \e[23m which for certain have worked since the very first 1.0 release. (Same for smxx/rmxx = cross out allegedly not working, etc.)

In any case, neovim seems to document ways to override the behavior here: https://neovim.io/doc/user/term.html
I'm not a (n)vim user so I can't say what the best approach is but setting TERM to xterm-kitty does definitely make colored underlines work in nvim.

@lhecker commented on GitHub (May 3, 2024): It's because neovim only enables extended and colored underlines if the terminfo database says so, as well as for certain specific terminals: https://github.com/neovim/neovim/blob/01e4a70d668d54a7cefa3ff53ec97e39df516265/src/nvim/tui/tui.c#L2365-L2375 While invisible-island.net does an absolutely fantastic job in maintaining the terminfo database overall, when it comes to Windows Terminal it's not quite perfect: * Since we're still "catching up" with the other established terminals, the terminfo database is usually behind by a year or so of our development (currently: 1.16 from Jan 2023). * It has some remarks about our correctness that I personally find very surprising. Among others it says "italics sitm/ritm do not work in WSL2" even though that's `\e[3m` and `\e[23m` which for certain have worked since the very first 1.0 release. (Same for smxx/rmxx = cross out allegedly not working, etc.) In any case, neovim seems to document ways to override the behavior here: https://neovim.io/doc/user/term.html I'm not a (n)vim user so I can't say what the best approach is but setting `TERM` to `xterm-kitty` does definitely make colored underlines work in nvim.
Author
Owner

@EpicBirb commented on GitHub (May 3, 2024):

It's because neovim only enables extended and colored underlines if the terminfo database says so, as well as for certain specific terminals: 01e4a70d66/src/nvim/tui/tui.c (L2365-L2375)

While invisible-island.net does an absolutely fantastic job in maintaining the terminfo database overall, when it comes to Windows Terminal it's not quite perfect:

  • Since we're still "catching up" with the other established terminals, the terminfo database is usually behind by a year or so of our development (currently: 1.16 from Jan 2023).
  • It has some remarks about our correctness that I personally find very surprising. Among others it says "italics sitm/ritm do not work in WSL2" even though that's \e[3m and \e[23m which for certain have worked since the very first 1.0 release. (Same for smxx/rmxx = cross out allegedly not working, etc.)

In any case, neovim seems to document ways to override the behavior here: https://neovim.io/doc/user/term.html I'm not a (n)vim user so I can't say what the best approach is but setting TERM to xterm-kitty does definitely make colored underlines work in nvim.

I see. Thanks for helping!

@EpicBirb commented on GitHub (May 3, 2024): > It's because neovim only enables extended and colored underlines if the terminfo database says so, as well as for certain specific terminals: https://github.com/neovim/neovim/blob/01e4a70d668d54a7cefa3ff53ec97e39df516265/src/nvim/tui/tui.c#L2365-L2375 > > While invisible-island.net does an absolutely fantastic job in maintaining the terminfo database overall, when it comes to Windows Terminal it's not quite perfect: > > * Since we're still "catching up" with the other established terminals, the terminfo database is usually behind by a year or so of our development (currently: 1.16 from Jan 2023). > * It has some remarks about our correctness that I personally find very surprising. Among others it says "italics sitm/ritm do not work in WSL2" even though that's `\e[3m` and `\e[23m` which for certain have worked since the very first 1.0 release. (Same for smxx/rmxx = cross out allegedly not working, etc.) > > In any case, neovim seems to document ways to override the behavior here: https://neovim.io/doc/user/term.html I'm not a (n)vim user so I can't say what the best approach is but setting `TERM` to `xterm-kitty` does definitely make colored underlines work in nvim. I see. Thanks for helping!
Author
Owner

@DHowett commented on GitHub (May 3, 2024):

Thanks for closing! Terminfo is something we really should make sure we keep up to date -- it's on my endless todo list 😆

@DHowett commented on GitHub (May 3, 2024): Thanks for closing! Terminfo is something we really should make sure we keep up to date -- it's on my endless todo list :laugh:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21628