patch 9.1.1456: comment plugin fails toggling if 'cms' contains
Commit:
https://github.com/vim/vim/commit/532a5fb13121fe849b83f77a3c1d62c95af4cdce
Author: Maxim Kim <[email protected]>
Date: Thu Jun 12 21:31:00 2025 +0200
patch 9.1.1456: comment plugin fails toggling if 'cms' contains \
Problem: comment plugin fails toggling if 'cms' contains \
Solution: escape backslash (Maxim Kim)
groff could be commented using \" or \# and comment plugin fails to
uncomment such things.
NOTE: if newstyle comment would be introduced, e.g. .\#
for groff test would need to be adjusted.
closes: #17530
Signed-off-by: Maxim Kim <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/pack/dist/opt/comment/autoload/comment.vim
b/runtime/pack/dist/opt/comment/autoload/comment.vim
index ffe5a1516..f678a98fa 100644
--- a/runtime/pack/dist/opt/comment/autoload/comment.vim
+++ b/runtime/pack/dist/opt/comment/autoload/comment.vim
@@ -1,7 +1,7 @@
vim9script
# Maintainer: Maxim Kim <[email protected]>
-# Last Update: 2025-04-22
+# Last Update: 2025-06-12
#
# Toggle comments
# Usage:
@@ -19,7 +19,7 @@ export def Toggle(...args: list<string>): string
if empty(&cms) || !&ma | return '' | endif
var cms = substitute(substitute(&cms, '\S\zs%s\s*', ' %s', ''), '%s\ze\S',
'%s ', '')
var [lnum1, lnum2] = [line("'["), line("']")]
- var cms_l = split(escape(cms, '*.'), '\s*%s\s*')
+ var cms_l = split(escape(cms, '*.\'), '\s*%s\s*')
var first_col = indent(lnum1)
var start_col = getpos("'[")[2] - 1
diff --git a/src/testdir/test_plugin_comment.vim
b/src/testdir/test_plugin_comment.vim
index 800c2751b..1c5074813 100644
--- a/src/testdir/test_plugin_comment.vim
+++ b/src/testdir/test_plugin_comment.vim
@@ -59,6 +59,30 @@ func Test_basic_uncomment()
call assert_equal(["# vim9script", "", "def Hello()", ' echo "Hello"',
"enddef"], result)
endfunc
+func Test_backward_slash_uncomment()
+ " Note this test depends on 'commentstring' setting in nroff ftplugin
+ CheckScreendump
+ let lines =<< trim END
+ .\" .TL Test backward slash uncomment
+ END
+
+ let input_file = "Test_backward_slash_uncomment_input.mom"
+ call writefile(lines, input_file, "D")
+
+ let buf = RunVimInTerminal('-c "packadd comment" ' .. input_file, {})
+
+ call term_sendkeys(buf, "gcc")
+ let output_file = "backward_slash_uncomment_test.mom"
+ call term_sendkeys(buf, $":w {output_file}\<CR>")
+ defer delete(output_file)
+
+ call StopVimInTerminal(buf)
+
+ let result = readfile(output_file)
+
+ call assert_equal([".TL Test backward slash uncomment"], result)
+endfunc
+
func Test_caseinsensitive_uncomment()
CheckScreendump
let lines =<< trim END
diff --git a/src/version.c b/src/version.c
index 69cf43362..a7b31cad5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -709,6 +709,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1456,
/**/
1455,
/**/
--
--
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/E1uPnrD-00FrNC-Lp%40256bit.org.