runtime(rst): Correctly end nested comments
Commit:
https://github.com/vim/vim/commit/4e9f16dd1ef8b48d4a37fde479adde1758796871
Author: Antony Lee <[email protected]>
Date: Mon Oct 13 18:28:58 2025 +0000
runtime(rst): Correctly end nested comments
Previously, a comment in a directive block would incorrectly mark
all subsequent lines in the directive block as comment, because the
syn-region did not check the leading indent.
related: #18566
Signed-off-by: Antony Lee <[email protected]>
Signed-off-by: Marshall Ward <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim
index 4b9379f5e..8094d8771 100644
--- a/runtime/syntax/rst.vim
+++ b/runtime/syntax/rst.vim
@@ -52,7 +52,8 @@ syn cluster rstDirectives
contains=rstFootnote,rstCitation,
\ rstHyperlinkTarget,rstExDirective
syn match rstExplicitMarkup '^\s*\.\.\_s'
- \ nextgroup=@rstDirectives,rstComment,rstSubstitutionDefinition
+ \ nextgroup=@rstDirectives,rstSubstitutionDefinition
+ \ contains=rstComment
" "Simple reference names are single words consisting of alphanumerics plus
" isolated (no two adjacent) internal hyphens, underscores, periods, colons
@@ -61,10 +62,10 @@ let s:ReferenceName =
'[[:alnum:]]\%([-_.:+]\?[[:alnum:]]\+\)*'
syn keyword rstTodo contained FIXME TODO XXX NOTE
-execute 'syn region rstComment contained' .
- \ ' start=/.*/'
- \ ' skip=+^$+' .
- \ ' end=/^\s\@!/ contains=rstTodo'
+syn region rstComment
+ \ start=' ^\z(\s*)\.\.(\_s+[\[|_]|\_s+.*::)@!' skip=+^$+ end=/^\(\z1
\)\@!/
+ \ contains=@Spell,rstTodo
+
execute 'syn region rstFootnote contained matchgroup=rstDirective' .
\ ' start=+\[\%(\d\+\|#\%(' . s:ReferenceName . '\)\=\|\*\)\]\_s+' .
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1v8NXi-00CgpP-Kb%40256bit.org.