From b9dfbcee13e93c95ab671cbc021a1357d154a83e Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 11 Jan 2026 16:29:15 +0100 Subject: [PATCH] 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. --- share/functions/__fish_change_key_bindings.fish | 1 + tests/checks/bind.fish | 1 + tests/checks/vi.fish | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/share/functions/__fish_change_key_bindings.fish b/share/functions/__fish_change_key_bindings.fish index 89ae6e08b..0d7406902 100644 --- a/share/functions/__fish_change_key_bindings.fish +++ b/share/functions/__fish_change_key_bindings.fish @@ -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 diff --git a/tests/checks/bind.fish b/tests/checks/bind.fish index 33ee3febc..2ace10655 100644 --- a/tests/checks/bind.fish +++ b/tests/checks/bind.fish @@ -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 diff --git a/tests/checks/vi.fish b/tests/checks/vi.fish index 1fe7d403b..5dca141b2 100644 --- a/tests/checks/vi.fish +++ b/tests/checks/vi.fish @@ -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}}