diff --git a/lib/core-complete.sh b/lib/core-complete.sh index c1c9395c..4d4e4cbf 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -1702,7 +1702,7 @@ function ble/complete/source:argument { fi if ((cand_count<=old_cand_count)); then - if local rex='^/?[-_a-zA-Z0-9.]+[:=]|^-[^-/=:]'; [[ $COMPV =~ $rex ]]; then + if local rex='^/?[-_a-zA-Z0-9.]+\+?[:=]|^-[^-/=:]'; [[ $COMPV =~ $rex ]]; then # var=filename --option=filename /I:filename など。 local prefix=$BASH_REMATCH value=${COMPV:${#BASH_REMATCH}} local COMP_PREFIX=$prefix diff --git a/lib/core-syntax.sh b/lib/core-syntax.sh index 737162f1..27d66ba4 100644 --- a/lib/core-syntax.sh +++ b/lib/core-syntax.sh @@ -1925,7 +1925,7 @@ function ble/syntax:bash/ctx-bracket-expression { ((_ble_syntax_attr[i++]=ctx,is_assign=1)) elif [[ $tail == ']+'* ]]; then ble/syntax/parse/set-lookahead 2 - [[ $tail == ']+=' ]] && ((_ble_syntax_attr[i]=ctx,i+=2,is_assign=1)) + [[ $tail == ']+='* ]] && ((_ble_syntax_attr[i]=ctx,i+=2,is_assign=1)) fi if [[ $is_assign ]]; then @@ -3864,6 +3864,8 @@ function ble/syntax:bash/find-end-of-array-index { ## @param[in] opts ## element-assignment ## 配列要素の場合にも変数代入の形式を許します。 +## long-option +## --long-option= の形式にも強制的に対応します。 ## @var[out] ret ## 右辺の開始位置を返します。 ## 変数代入の形式でない時には単語の開始位置を返します。 @@ -3887,6 +3889,9 @@ function ble/syntax:bash/find-rhs { rex='^(\[)' fi fi + if [[ :$opts: == *:long-option:* ]]; then + rex=${rex:+$rex'|'}'^--[-_a-zA-Z0-9]+=' + fi if [[ $rex && $word =~ $rex ]]; then local last_char=${BASH_REMATCH:${#BASH_REMATCH}-1}