aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bash-completion.sh11
1 files 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