From 8926de0a1f69d17f5b05099cfaaa52d833084c2f Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 26 Feb 2024 04:24:06 +0900 Subject: [PATCH] Exclude the `bind -x` commands from interactive commands (#152) * Exclude the `bind -x` commands from interactive commands * Check COMP_POINT instead of possibly empty COMP_LINE The check for COMP_LINE can fail because it can be empty in the completion function for the empty command line "complete -F _func -E". --- bash-preexec.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bash-preexec.sh b/bash-preexec.sh index 5bb11b6..641346a 100644 --- a/bash-preexec.sh +++ b/bash-preexec.sh @@ -222,9 +222,9 @@ __bp_preexec_invoke_exec() { return fi - if [[ -n "${COMP_LINE:-}" ]]; then - # We're in the middle of a completer. This obviously can't be - # an interactively issued command. + if [[ -n "${COMP_POINT:-}" || -n "${READLINE_POINT:-}" ]]; then + # We're in the middle of a completer or a keybinding set up by "bind + # -x". This obviously can't be an interactively issued command. return fi if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then