fish_config: Write an empty prompt if necessary

This clears the right prompt if the new preset doesn't have any.

This was supposed to be fixed but was broken again in
f3b950157d.

Fixes #10675.
This commit is contained in:
Fabian Boehm 2024-08-19 17:03:52 +02:00
parent ad674c61dc
commit c9bc04f274

View file

@ -118,12 +118,18 @@ function fish_config --description "Launch fish's web based configuration"
# or we'd throw an error on a stock fish.
path is $__fish_config_dir/functions/fish_prompt.fish
and cp $__fish_config_dir/functions/fish_prompt.fish{,.bak}
path is $__fish_config_dir/functions/fish_right_prompt.fish
and cp $__fish_config_dir/functions/fish_right_prompt.fish{,.bak}
set -l have
if set -q argv[1]
for f in $prompt_dir/$argv[1].fish
if test -f $f
set have $f
# Set the functions to empty so we empty the file
# if necessary.
function fish_prompt; end
function fish_right_prompt; end
source $f
or return 2
end