Skip to content

Commit 44fa043

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 44fa043

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

crates/atuin/src/shell/atuin.bash

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,13 @@ __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+
if [[ $__atuin_bind_ctrl_r == true || $__atuin_bind_up_arrow == true ]]; then
390+
__atuin_macro_chain='\e[0;0A'
391+
for __atuin_keymap in emacs vi-insert vi-command; do
392+
bind -m "$__atuin_keymap" "\"$__atuin_macro_chain\": \"\""
393+
done
394+
unset -v __atuin_keymap
395+
fi
394396

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

0 commit comments

Comments
 (0)