From 4b4643be07e4e9259b3cb05e511e5047778733c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 23 May 2022 21:27:57 +0800 Subject: vim-patch:8.2.5008: when 'formatoptions' contains "/" wrongly wrapping comment (#18717) Problem: When 'formatoptions' contains "/" wrongly wrapping a long trailing comment. Solution: Pass the OPENLINE_FORMAT flag. https://github.com/vim/vim/commit/7e667788150be617aeac42b0d668618ac33ab9da --- src/nvim/testdir/test_textformat.vim | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 92705cb69f..748af199b2 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -289,11 +289,28 @@ func Test_format_c_comment() x END call assert_equal(expected, getline(1, '$')) + + " Comment is formatted when it wraps + normal 2GA with some more text added + let expected =<< trim END + nop; + val = val; // This is a comment + // with some more text + // added + x + END + call assert_equal(expected, getline(1, '$')) + set fo-=/ " using 'indentexpr' instead of 'cindent' does not repeat a comment setl nocindent indentexpr=2 - 3delete + %del + let text =<< trim END + nop; + val = val; // This is a comment + END + call setline(1, text) normal 2Gox let expected =<< trim END nop; -- cgit