Skip to content

Commit

Permalink
highlight: fix unhighlighted tilde expansions "~+"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Dec 2, 2020
1 parent cc5e4d1 commit 3f7f044
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/core-syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ function ble-syntax:bash/check-tilde-expansion {
local chars="${_ble_syntax_bash_chars[CTX_ARGI]}/:"
ble-syntax:bash/cclass/update/reorder chars
local delimiters="$_ble_syntax_bash_IFS;|&()<>"
local rex='^(~[^'$chars']*)([^'$delimiters'/:]?)'; [[ $tail =~ $rex ]]
local rex='^(~\+|~[^'$chars']*)([^'$delimiters'/:]?)'; [[ $tail =~ $rex ]]
local str=${BASH_REMATCH[1]}

local path attr=$ctx
Expand All @@ -2145,6 +2145,12 @@ function ble-syntax:bash/check-tilde-expansion {
ble-assert 'ble/util/unlocal tail; [[ $tail == ":~"* ]]'
ble-syntax/parse/nest-pop
fi
else
# ~+ で始まってかつ有効なチルダ展開ではない時 ~ まで後退 (#D1424)
if [[ $str == '~+' ]]; then
ble/syntax/parse/set-lookahead 3
str='~'
fi
fi
((_ble_syntax_attr[i]=attr,i+=${#str}))
else
Expand Down

0 comments on commit 3f7f044

Please sign in to comment.