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 0f85719 commit 1f9abf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/core-syntax.sh
Expand Up @@ -2397,8 +2397,8 @@ function ble/syntax:bash/check-tilde-expansion {
if ((tilde_enabled)); then
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 delimiters="$_ble_syntax_bash_IFS;|&)<>"
local rex='^(~\+|~[^'$chars']*)([^'$delimiters'/:]?)'; [[ $tail =~ $rex ]]
local str=${BASH_REMATCH[1]}

local path attr=$ctx
Expand All @@ -2413,6 +2413,12 @@ function ble/syntax:bash/check-tilde-expansion {
ble/util/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 1f9abf6

Please sign in to comment.