aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-03-20 13:16:48 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-03-20 13:18:45 +0100
commitc791ca53d235380d10405eaa72b5aa7afc55c82f (patch)
tree4faa4c5d2be14e030112dd80ebce3b8d54b01957
parent1f6ec06e9664e28c04636f83b713abb4459da9f6 (diff)
Don't trim word if : or = is not in $COMP_WORDBREAKS
-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