From ae649650de3509e22ee6fad5cfa72998d40f2a92 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 31 Jan 2022 15:44:54 +0800 Subject: vim-patch:8.2.3938: line comment start is also found in a string Problem: Line comment start is also found in a string. Solution: Skip line comments in a string. https://github.com/vim/vim/commit/ba26367fea3b63df49d274f3d5cca0af38402add --- src/nvim/testdir/test_textformat.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nvim/testdir/test_textformat.vim') diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index e1d155eba7..052c32214d 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -261,6 +261,21 @@ func Test_format_c_comment() END call assert_equal(expected, getline(1, '$')) + " Using "o" does not repeat a comment in a string + %del + let text =<< trim END + nop; + val = " // This is not a comment"; + END + call setline(1, text) + normal 2Gox + let expected =<< trim END + nop; + val = " // This is not a comment"; + x + END + call assert_equal(expected, getline(1, '$')) + " Using CTRL-U after "o" fixes the indent %del let text =<< trim END -- cgit