Skip to content

Commit 52b889f

Browse files
committed
fix: Disable Bash macro chain when no binding enabled (#2969)
If the user is not binding any commands, then there is no need to do the macro chain workaround. This causes issues if the user deliberately disabled the bindings because their Bash session does not have the line editor enabled; this macro chain binding will then cause errors.
1 parent 592df55 commit 52b889f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/atuin/src/shell/atuin.bash

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,14 @@ __atuin_widget_run() {
386386
# The number <n> is fixed to be 1 in the input stream, so we may use <n> = 0
387387
# (which is unlikely be used) as our special key sequences.
388388

389-
__atuin_macro_chain='\e[0;0A'
390-
for __atuin_keymap in emacs vi-insert vi-command; do
391-
bind -m "$__atuin_keymap" "\"$__atuin_macro_chain\": \"\""
392-
done
393-
unset -v __atuin_keymap
389+
# shellcheck disable=SC2154
390+
if [[ $__atuin_bind_ctrl_r == true || $__atuin_bind_up_arrow == true ]]; then
391+
__atuin_macro_chain='\e[0;0A'
392+
for __atuin_keymap in emacs vi-insert vi-command; do
393+
bind -m "$__atuin_keymap" "\"$__atuin_macro_chain\": \"\""
394+
done
395+
unset -v __atuin_keymap
396+
fi
394397

395398
if ((BASH_VERSINFO[0] >= 5 || BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 3)); then
396399
# In Bash >= 4.3

0 commit comments

Comments
 (0)