Curly underlines in set_color and fish_color_*

set_color --underline=curly outputs \e[4:3m which breaks the following
terminals:
- Terminal.app interprets it as yellow background
- abduco and dvtm interpret it as green foreground
- JetBrains terminals interprets it as yellow background
- urxvt interprets it as yellow background

terminals that interpret curly as single underline:
- tmux [1]
- emacs ansi-term [2]
- emacs vterm
- GNU screen (also wrongly turns on italic mode)
- terminology (also wrongly turns on italic mode)
- Vim's :terminal

[1]: https://github.com/orgs/tmux/discussions/4477
[2]: https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-04/msg01093.html

Closes #10957
This commit is contained in:
Johannes Altmanninger
2025-04-13 15:10:57 +02:00
parent ef25f1d27b
commit cc9849c279
12 changed files with 123 additions and 38 deletions

View File

@@ -240,7 +240,11 @@ def parse_color(color_str):
if comp == "--bold" or comp == "-o":
bold = True
elif comp == "--underline" or comp == "-u":
underline = True
underline = "single"
elif comp.startswith("--underline="):
underline = comp.stripprefix("--underline=")
elif comp.startswith("-u"): # Multiple short options like "-rbcurly" are not yet supported.
underline = comp.stripprefix("-u")
elif comp == "--italics" or comp == "-i":
italics = True
elif comp == "--dim" or comp == "-d":
@@ -295,8 +299,8 @@ def unparse_color(col):
ret += col["color"]
if col["bold"]:
ret += " --bold"
if col["underline"]:
ret += " --underline"
if col["underline"] is not None:
ret += " --underline=" + col["underline"]
if col["italics"]:
ret += " --italics"
if col["dim"]: