vim-patch:c68e64d: runtime(sh): fix spurious nextgroup=shComment on shEscape

Remove `nextgroup=shComment` from the `shEscape` syntax pattern.
This was causing `#` characters after escape sequences inside
double-quoted strings to be misinterpreted as comments, breaking
highlighting for the rest of the file.

Add a test case for escaped characters followed by # in double quotes.

fixes:  vim/vim#19053
closes: vim/vim#19414

c68e64dac3

Co-authored-by: Bozhidar Batsov <bozhidar@batsov.dev>
This commit is contained in:
zeertzjq
2026-02-16 08:44:36 +08:00
parent 172776b459
commit fdf20f32ee

View File

@@ -21,6 +21,7 @@
" 2025 Sep 23 simplify ksh logic, update sh statements #18355
" 2026 Jan 15 highlight command switches that contain a digit
" 2026 Feb 11 improve support for KornShell function names and variables
" 2026 Feb 15 improve comment handling #19414
" }}}
" Version: 208
" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
@@ -452,7 +453,7 @@ endif
"======
syn match shWrapLineOperator "\\$"
syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList
syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.'
" $() and $(()): {{{1
" $(..) is not supported by sh (Bourne shell). However, apparently