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