Skip to content

Commit

Permalink
Exclude the bind -x commands from interactive commands (#152)
Browse files Browse the repository at this point in the history
* 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".
  • Loading branch information
akinomyoga authored Feb 25, 2024
1 parent 1f77dc0 commit 8926de0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bash-preexec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8926de0

Please sign in to comment.