diff --git a/lib/core-syntax.sh b/lib/core-syntax.sh index 8515c50f..0bb4363e 100644 --- a/lib/core-syntax.sh +++ b/lib/core-syntax.sh @@ -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 @@ -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