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".
This commit is contained in:
Koichi Murase 2024-02-26 04:24:06 +09:00 committed by GitHub
parent 1f77dc0935
commit 8926de0a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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