diff options
| author | Koichi Murase <myoga.murase@gmail.com> | 2025-11-01 04:14:54 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-31 12:14:54 -0700 |
| commit | ea218c546f325ea408e4e10cefee5f5ac97b35b8 (patch) | |
| tree | db3aeee80d8c156c8a803189165e1e9b484aa209 | |
| parent | fix(bash/blesh): suppress error message for auto-complete source (#2976) (diff) | |
| download | atuin-ea218c546f325ea408e4e10cefee5f5ac97b35b8.zip | |
fix(bash): work around a keybinding bug of Bash 5.1 (#2975)
This adds a workaround for an issue with a Bash-5.1 bug reported by
@MaxenceG2M at
https://github.com/atuinsh/atuin/issues/962#issuecomment-3451132291. See
the added code comments for details.
## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
Diffstat (limited to '')
| -rw-r--r-- | crates/atuin/src/shell/atuin.bash | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/atuin/src/shell/atuin.bash b/crates/atuin/src/shell/atuin.bash index 63730d0b..88b6af3a 100644 --- a/crates/atuin/src/shell/atuin.bash +++ b/crates/atuin/src/shell/atuin.bash @@ -412,6 +412,17 @@ if ((BASH_VERSINFO[0] >= 5 || BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 3)); local ikeyseq1='\C-x\C-_A'$((1 + widget))'\a' local ikeyseq2=$__atuin_macro_chain + if ((BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] == 1)); then + # Workaround for Bash 5.1: Bash 5.1 has a bug that overwriting an + # existing "bind -x" keybinding breaks other existing "bind -x" + # keybindings [1,2]. To work around the problem, we explicitly + # unbind an existing keybinding before overwriting it. + # + # [1] https://lists.gnu.org/archive/html/bug-bash/2021-04/msg00135.html + # [2] https://github.com/atuinsh/atuin/issues/962#issuecomment-3451132291 + bind -m "$keymap" -r "$keyseq" + fi + bind -m "$keymap" "\"$keyseq\": \"$ikeyseq1$ikeyseq2\"" bind -m "$keymap" -x "\"$ikeyseq1\": __atuin_widget_run $widget" } |
