[vim/vim] runtime(sh): fix Bash array value highlighting after escaped parens (PR #20705)

1 view
Skip to first unread message

Francesco

unread,
1:38 PM (3 hours ago) 1:38 PM
to vim/vim, Subscribed

Bash associative arrays with escaped parens in the subscript break
highlighting for everything after them, e.g.:

declare -A bar=(
  [\(\)]="baz"
)
echo ${bar[\(\)]}

The echo on the last line gets highlighted as an array value instead
of a statement.

@shArrayValueList (used inside array subscripts) didn't include
shEscape, so an escaped ( was picked up by shParen instead of
being treated as a literal char. shParen then never found its
closing ) on that line (the escaped \) got eaten by shEscape,
which is in shParen's own contains list), so it kept looking forward
and consumed the real closing paren of the array. The array region
never closed and bled into the following lines.

Adding shEscape to @shArrayValueList (bash and ksh branches) fixes
it.

closes: #18712


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20705

Commit Summary

  • 2c4417d runtime(sh): fix Bash array value highlighting after escaped parens

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20705@github.com>

Reply all
Reply to author
Forward
0 new messages