mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-21 00:31:15 -03:00
Given that this curly underline will also be red, it should be widely
understood as error.
Since fish always renders immediately (and synchronously), typing "echo"
will briefly show an intermediate curly line. Maybe fish should redraw
after a timer elapses? This is probably unrelated to this patch.
As mentioned in cc9849c279 (Curly underlines in set_color and fish_color_*,
2025-04-13), there are still some terminals that interpret "\e[4:3m" as
something other than curly underline.
Some of them interpret it as background/foreground color, and some terminal
multiplexers downgrade it to straight underlines (which often happens due
to a false positive). I want to change this in multiplexers where possible
(see https://github.com/orgs/tmux/discussions/4477) but for now, disable
this feature in multiplexers (there are just a handful).
In a few years, those terminals will maybe agree with XTerm. Until then,
use XTGETTCAP as a temporary stepping stone. We could also read the terminfo
database but that will give only very few true positives, and lots of false
negatives. Better implement XTGETTCAP in the relevant terminals.
Note that if the universal variables use the "--track" flag (from the
grandparent commit), then
rm -rf /tmp/newhome
foot -e env $HOME=/tmp/newhome fish
xterm -e env $HOME=/tmp/newhome fish
will "magically work". For foot, $fish_color_error will have --underline=curly.
For xterm, it will not, due to the call to "fish_config theme update".
But of course since it's a universal variable, running fish in xterm
would also downgrade the fish running in other terminals.
Add a "fish_config theme save --yes" flag because "status xtgettcap"
requires stdin to be a terminal. I'd probably drop this requirement, and
make "status xtgettcap" always use fish's stdin and not its own. That'd be
cheating because an external command can't do that but I don't think this
change would be hurting anyone.
52 lines
1.7 KiB
Fish
52 lines
1.7 KiB
Fish
#RUN: %fish %s
|
|
|
|
mkdir $__fish_config_dir/themes
|
|
echo >$__fish_config_dir/themes/foo.theme '
|
|
fish_color_normal cyan
|
|
fish_color_error brred --underline=curly
|
|
'
|
|
|
|
set -g fish_pager_color_secondary_background custom-value
|
|
fish_config theme choose foo
|
|
|
|
set -S fish_color_normal
|
|
# CHECK: $fish_color_normal: set in global scope, unexported, with 1 elements
|
|
# CHECK: $fish_color_normal[1]: |cyan|
|
|
set -S fish_pager_color_secondary_background
|
|
# CHECK: $fish_pager_color_secondary_background: set in global scope, unexported, with 0 elements
|
|
|
|
# Not a default theme, so we allow --underline=curly even if we don't run inside a terminal that
|
|
# advertises support via XTGETTCAP.
|
|
set -S fish_color_error
|
|
# CHECK: $fish_color_error: set in global scope, unexported, with 2 elements
|
|
# CHECK: $fish_color_error[1]: |brred|
|
|
# CHECK: $fish_color_error[2]: |--underline=curly|
|
|
|
|
|
|
function change-theme
|
|
echo >$__fish_config_dir/themes/fake-default.theme 'fish_color_command' $argv
|
|
end
|
|
|
|
change-theme 'green'
|
|
echo yes | fish_config theme save --track fake-default
|
|
echo $fish_color_command
|
|
# CHECK: green --track=fake-default
|
|
|
|
change-theme 'green --bold'
|
|
fish_config theme update
|
|
|
|
echo $fish_color_command
|
|
# CHECK: green --bold --track=fake-default
|
|
|
|
# Test that we silently update when there is a shadowing global.
|
|
change-theme 'green --italics'
|
|
set -g fish_color_command normal
|
|
fish_config theme update
|
|
set -S fish_color_command
|
|
# CHECK: $fish_color_command: set in global scope, unexported, with 1 elements
|
|
# CHECK: $fish_color_command[1]: |normal|
|
|
# CHECK: $fish_color_command: set in universal scope, unexported, with 3 elements
|
|
# CHECK: $fish_color_command[1]: |green|
|
|
# CHECK: $fish_color_command[2]: |--italics|
|
|
# CHECK: $fish_color_command[3]: |--track=fake-default|
|