mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 13:01:21 -03:00
Fix spurious status=1 from calling binding function from config
A command like "fish -C fish_default_key_bindings" shows a exit status of 1 in the default prompt. Fix that.
This commit is contained in:
@@ -8,6 +8,7 @@ function __fish_change_key_bindings --argument-names bindings
|
||||
# We try to use `set --no-event`, but to avoid leaving the user without bindings
|
||||
# if they run this with an older version we fall back on setting the variable
|
||||
# with an event.
|
||||
true
|
||||
if ! set --no-event $scope fish_key_bindings $bindings 2>/dev/null
|
||||
# This triggers the handler, which calls us again
|
||||
set $scope fish_key_bindings $bindings
|
||||
|
||||
@@ -7,6 +7,7 @@ set -l tmpdir (mktemp -d)
|
||||
for bindings in true fish_default_key_bindings fish_vi_key_bindings
|
||||
$fish -c "
|
||||
$bindings
|
||||
or echo >&2 error setting bindings: status=\$status
|
||||
bind > $tmpdir/old
|
||||
bind --erase --all --preset
|
||||
bind --erase --all
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
fish_vi_key_bindings
|
||||
|
||||
commandline '1'; commandline --cursor 0; fish_vi_dec
|
||||
# CHECK: {{\x1b\[6 q}}
|
||||
echo
|
||||
commandline --current-buffer
|
||||
# CHECK: 0
|
||||
|
||||
@@ -113,3 +115,5 @@ commandline --current-buffer
|
||||
commandline 'to 2022-04-09'; commandline --cursor 11; fish_vi_inc
|
||||
commandline --current-buffer
|
||||
# CHECK: to 2022-04-08
|
||||
|
||||
# CHECK: {{\x1b\[2 q}}
|
||||
|
||||
Reference in New Issue
Block a user