From df148c834fa0eb4a99cac18720e05059bf771430 Mon Sep 17 00:00:00 2001 From: Ajeet D'Souza <98ajeet@gmail.com> Date: Fri, 25 Feb 2022 04:15:19 +0530 Subject: [PATCH] Require bash 4.4+ for completions (#354) --- templates/bash.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/bash.txt b/templates/bash.txt index 88fb9a2..0cd3baf 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -115,11 +115,12 @@ function {{cmd}}i() { } # Load completions. -# - Bash 4.0+ is needed to use `mapfile`. +# - Bash 4.4+ is required to use `@Q`. # - Completions require line editing. Since Bash supports only two modes of # line editing (`vim` and `emacs`), we check if either them is enabled. # - Completions don't work on `dumb` terminals. -if [[ ${BASH_VERSINFO:-0} -ge 4 && :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} != 'dumb' ]]; then +if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VERSINFO[0]:-0} -ge 5 ]] && + [[ :"${SHELLOPTS}": =~ :(vi|emacs): && ${TERM} != 'dumb' ]]; then # Use `printf '\e[5n'` to redraw line after fzf closes. \builtin bind '"\e[0n": redraw-current-line' &>/dev/null