From c791ca53d235380d10405eaa72b5aa7afc55c82f Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 20 Mar 2015 13:16:48 +0100 Subject: Don't trim word if : or = is not in $COMP_WORDBREAKS --- bash-completion.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bash-completion.sh b/bash-completion.sh index e7f0577..d07e3ed 100644 --- a/bash-completion.sh +++ b/bash-completion.sh @@ -55,13 +55,20 @@ _icevault() { fi [ $(($OPTIND + 1)) -lt $cword ] && return - local colon_word= # see __ltrim_colon_completions + local colon_word= if [ -z "$cur" -a $OPTIND -eq $cword ] || [ -z "$cur" -a $(($OPTIND + 1)) -eq $cword -a "${words[OPTIND]}" = fill ]; then cur="$(./icevault _geturi)"/ # get URI from webpage else cur=$(dequote "$cur") - colon_word=${cur%"${cur##*[:=]}"} # trim words with : or = in COMP_WORDBREAKS + # trim words with : or = in $COMP_WORDBREAKS; see __ltrim_colon_completions + if [[ "$cur" == *[:=]* && "$COMP_WORDBREAKS" == *:* && "$COMP_WORDBREAKS" == *=* ]]; then + colon_word=${cur%"${cur##*[:=]}"} + elif [[ "$cur" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then + colon_word=${cur%"${cur##*:}"} + elif [[ "$cur" == *=* && "$COMP_WORDBREAKS" == *=* ]]; then + colon_word=${cur%"${cur##*=}"} + fi fi local uri -- cgit v1.2.3