From b80059e21ff1fb55a995d4fd8c49f16aaf911dbf Mon Sep 17 00:00:00 2001 From: Evan Hahn Date: Thu, 12 Mar 2026 19:21:04 -0500 Subject: [PATCH] Fix zsh history widget when `sh_glob` option is on (#4714) Fixes #4712. The CTRL-R history widget failed in zsh when [zsh's `sh_glob` option][0] was on. This fixes that by disabling the option locally, like we disable other options. [0]: https://zsh.sourceforge.io/Doc/Release/Options.html#:~:text=SH%5FGLOB,ksh%2E --- shell/key-bindings.zsh | 2 +- test/test_shell_integration.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index 14c31de7..1b43b1b9 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -129,7 +129,7 @@ fi # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { local selected extracted_with_perl=0 - setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases no_glob no_ksharrays extendedglob 2> /dev/null + setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases no_glob no_sh_glob no_ksharrays extendedglob 2> /dev/null # Ensure the module is loaded if not already, and the required features, such # as the associative 'history' array, which maps event numbers to full history # lines, are set. Also, make sure Perl is installed for multi-line output. diff --git a/test/test_shell_integration.rb b/test/test_shell_integration.rb index b67f307a..e907a002 100644 --- a/test/test_shell_integration.rb +++ b/test/test_shell_integration.rb @@ -920,6 +920,7 @@ class TestZsh < TestBase end test_perl_and_awk 'ctrl_r_multiline_index_collision' do + tmux.send_keys 'setopt sh_glob', :Enter # Leading number in multi-line history content is not confused with index prepare_ctrl_r_test tmux.send_keys "'line 1"