fish_config: improve consistency

The theme variable filter applies to whole lines, so it's weird to
only apply it to the first token, and we don't do that elsewhere.
This commit is contained in:
Johannes Altmanninger
2025-11-25 12:52:39 +01:00
parent 5cc953b18d
commit e68ea35f02

View File

@@ -252,20 +252,17 @@ function fish_config --description "Launch fish's web based configuration"
begin
__fish_config_cat_theme $argv[1]
or return
end | while read -lat toks
# The whitelist allows only color variables.
# Not the specific list, but something named *like* a color variable.
# This also takes care of empty lines and comment lines.
string match -rq -- $theme_var_filter $toks[1]
or continue
# If we're supposed to set universally, remove any shadowing globals
# so the change takes effect immediately (and there's no warning).
if test x"$scope" = x-U; and set -qg $toks[1]
set -eg $toks[1]
end |
string match -r -- $theme_var_filter |
while read -lat toks
# If we're supposed to set universally, remove any shadowing globals
# so the change takes effect immediately (and there's no warning).
if test x"$scope" = x-U; and set -qg $toks[1]
set -eg $toks[1]
end
set $scope $toks
set -a defined_colors $toks[1]
end
set $scope $toks
set -a defined_colors $toks[1]
end
# Set all colors that aren't mentioned to empty
for c in $known_colors