runtime(comment): handle special chars ^$[ robustly Commit: https://github.com/vim/vim/commit/aef2e53cf8f331a0566857ac80a89a67e0d77722 Author: Maxim Kim <haba...@gmail.com> Date: Fri Jun 13 20:18:50 2025 +0200
runtime(comment): handle special chars ^$[ robustly Make sure comment toggling works when 'commentstring' contains any of the following regex special characters by escaping them: ^ $ [ closes: #17537 Signed-off-by: Maxim Kim <haba...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/pack/dist/opt/comment/autoload/comment.vim b/runtime/pack/dist/opt/comment/autoload/comment.vim index f678a98fa..74e091c35 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 <haba...@gmail.com> -# Last Update: 2025-06-12 +# Last Update: 2025-06-13 # # 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 -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uQ9AB-0008X6-Td%40256bit.org.