color: prefer set_color --reset over set_color normal

`set_color normal` is too ambiguous and easily misinterpreted since
it actually reset all colors and modes instead of resetting just
the foreground color as one without prior knowledge might expect.

Closes #12548
This commit is contained in:
Nahor
2026-03-10 15:26:34 -07:00
committed by Johannes Altmanninger
parent 9ea760c401
commit 8679464689
69 changed files with 214 additions and 209 deletions

View File

@@ -89,7 +89,7 @@ echo no default universal variables
# CHECK: fish_color_autosuggestion red
# CHECK: fish_color_command green --theme=default
# CHECK: fish_color_autosuggestion red
# CHECK: fish_color_command normal --theme=default
# CHECK: fish_color_command --reset --theme=default
'
}

View File

@@ -183,7 +183,7 @@ echo >$__fish_config_dir/themes/custom-from-userconf.theme \
{
print-sample-colors
# CHECK: normal=normal --theme=default
# CHECK: normal=--reset --theme=default
# CHECK: autosuggestion=brblack --theme=default
fish_config theme choose custom-from-userconf --color-theme=unknown
@@ -203,12 +203,12 @@ echo >$__fish_config_dir/themes/custom-from-userconf.theme \
fish_config theme choose default --color-theme=unknown
print-sample-colors
# CHECK: normal=normal --theme=default
# CHECK: normal=--reset --theme=default
# CHECK: autosuggestion=brblack --theme=default
set -S fish_color_normal
# CHECK: $fish_color_normal: set in global scope, unexported, with 2 elements
# CHECK: $fish_color_normal[1]: |normal|
# CHECK: $fish_color_normal[1]: |--reset|
# CHECK: $fish_color_normal[2]: |--theme=default|
# CHECK: $fish_color_normal: set in universal scope, unexported, with 2 elements
# CHECK: $fish_color_normal[1]: |yellow|
@@ -217,7 +217,7 @@ echo >$__fish_config_dir/themes/custom-from-userconf.theme \
echo yes | fish_config theme save default
set -S fish_color_normal
# CHECK: $fish_color_normal: set in universal scope, unexported, with 1 elements
# CHECK: $fish_color_normal[1]: |normal|
# CHECK: $fish_color_normal[1]: |--reset|
}
{

View File

@@ -153,7 +153,7 @@ begin
end
# Only the longest run between carriage returns is kept because the rest is overwritten.
string length --visible (set_color normal)abcdef\rfooba(set_color red)raaa
string length --visible (set_color --reset)abcdef\rfooba(set_color red)raaa
# (foobaraaa)
# CHECK: 9

View File

@@ -13,5 +13,5 @@ sendline, expect_prompt = sp.sendline, sp.expect_prompt
expect_prompt()
sendline("set_color --italics")
expect_prompt()
sendline("set_color normal")
sendline("set_color --reset")
expect_prompt()