uvar migration: tell users to restart running sessions

Users who run the default theme are silently migrated to global
variables. Universal color variables are deleted, leaving existing
sessions uncolored. Tell the user to restart them, and make some
other improvements; now it looks like:

	fish: upgraded to version 4.3:
	* Color variables are no longer set in universal scope.
	  To restore syntax highlighting in other fish sessions, please restart them.
	* The fish_key_bindings variable is no longer set in universal scope by default.
	  Migrated it to a global variable set in  ~/.config/fish/conf.d/fish_frozen_key_bindings.fish

Same for users who do not use the default theme (who already got a
message before this change). For them, the first bullet point looks
like this:

	[...]
	* Color variables are no longer set in universal scope by default.
	  Migrated them to global variables set in ~/.config/fish/conf.d/fish_frozen_theme.fish
	  To restore syntax highlighting in other fish sessions, please restart them.
	[...]

Closes #12161
This commit is contained in:
Johannes Altmanninger
2025-12-25 08:38:13 +01:00
parent b2f4befc7e
commit 74af4f10de
3 changed files with 39 additions and 20 deletions

View File

@@ -31,10 +31,13 @@ echo no default universal variables
provoke-migration
$fish -c __fish_theme_migrate
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{.*}}
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}}
# CHECK: {{.*Color.*no.longer.*universal.*}}
# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_theme.fish{{\x1b\[m}}
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{.*}}
# CHECK: {{.*restart.*}}
# CHECK: {{.*fish_key_bindings.*no.longer.*universal.*}}
# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_key_bindings.fish{{\x1b\[m}}
# CHECK: {{.*help relnotes.*}}
grep -v '^#' $__fish_config_dir/conf.d/fish_frozen_theme.fish | grep . | head -3
# CHECK: set --global fish_color_autosuggestion 7f7f7f
# CHECK: set --global fish_color_cancel ffffff --background=000000
@@ -54,13 +57,17 @@ echo no default universal variables
set -Ue fish_color_autosuggestion
}
# If existing universal variables match old defaults exactly (common case), pretend they don't
# exist at all (silently delete them).
# If existing universal colors match old defaults exactly (common case), don't migrate but
# delete them.
{
echo yes | fish_config theme save default --color-theme=unknown
fake-old-uvars
provoke-migration
$fish -c __fish_theme_migrate
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}}
# CHECK: {{.*Color.*no.longer.*universal.*}}
# CHECK: {{.*restart.*}}
# CHECK: {{.*help relnotes.*}}
not path is $__fish_config_dir/conf.d/fish_frozen_theme.fish
and echo ok
# CHECK: ok
@@ -86,14 +93,18 @@ echo no default universal variables
'
}
# If existing universal variables match old defaults exactly (common case),
# don't migrate them and silently delete them).
# If existing universal key bindings match old defaults exactly (common case), don't migrate
# but delete them).
{
set -U fish_key_bindings fish_vi_key_bindings
provoke-migration
$fish -c __fish_theme_migrate
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{.*}}.
# CHECK: {{\x1b\[1m}}fish:{{\x1b\[m}} {{upgraded.*}}
# CHECK: {{.*Color.*no.longer.*universal.*}}
# CHECK: {{.*restart.*}}
# CHECK: {{.*fish_key_bindings.*no.longer.*universal.*}}
# CHECK: Migrated {{.*}} {{\S*}}/xdg_config_home/fish/conf.d/fish_frozen_key_bindings.fish{{\x1b\[m}}
# CHECK: {{.*help relnotes.*}}
path is $__fish_config_dir/conf.d/fish_frozen_key_bindings.fish
and echo ok
# CHECK: ok