From b59eba3ada13ee3ceb0f8decebd261e55b2baa2d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 16 Feb 2026 07:39:02 +0800 Subject: [PATCH 1/3] vim-patch:9.2.0007: cindent: recognizing labels within commented lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Comment lines which start like a label are recognized as a label and indented based on that. Solution: Check if the position is in a comment after recognizing a label in cin_islabel (Anttoni Erkkilä) closes: vim/vim#19397 https://github.com/vim/vim/commit/9af18686c7842c8002268d861e37f6ad46a9b641 Co-authored-by: Anttoni Erkkilä --- src/nvim/indent_c.c | 3 +++ test/old/testdir/test_cindent.vim | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 2a30573a0b..40e22f8c9a 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -370,6 +370,9 @@ static bool cin_islabel(void) // XXX return false; } + if (ind_find_start_CORS(NULL)) { + return false; // Don't accept a label in a comment or a raw string. + } // Only accept a label if the previous line is terminated or is a case // label. pos_T cursor_save; diff --git a/test/old/testdir/test_cindent.vim b/test/old/testdir/test_cindent.vim index 345f005815..8a15529a41 100644 --- a/test/old/testdir/test_cindent.vim +++ b/test/old/testdir/test_cindent.vim @@ -1127,6 +1127,12 @@ func Test_cindent_1() a(); } + void func() { + /* aaaaaa + bbbbb: + ccccccc */ + } + /* end of AUTO */ [CODE] @@ -2130,6 +2136,12 @@ func Test_cindent_1() a(); } + void func() { + /* aaaaaa + bbbbb: + ccccccc */ + } + /* end of AUTO */ [CODE] From 77d396caf4097228830e7e4c7f318f22da8892e0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 16 Feb 2026 07:40:16 +0800 Subject: [PATCH 2/3] vim-patch:9.2.0009: tests: test_cindent are not ordered Problem: tests: the tests test_cindent_* functions were numbered inconsistently, causing them to be executed in wrong order. Solution: Rename the test_cindent functions with zero-padded numbers. https://github.com/vim/vim/commit/9308c85a7ee54d0a0d9956e4436cd5d1dce90914 Co-authored-by: Christian Brabandt --- test/old/testdir/test_cindent.vim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/old/testdir/test_cindent.vim b/test/old/testdir/test_cindent.vim index 8a15529a41..3acdca66ca 100644 --- a/test/old/testdir/test_cindent.vim +++ b/test/old/testdir/test_cindent.vim @@ -127,7 +127,7 @@ func Test_cindent_func() bwipe! endfunc -func Test_cindent_1() +func Test_cindent_01() new setl cindent ts=4 sw=4 setl cino& sts& @@ -2150,7 +2150,7 @@ func Test_cindent_1() enew! | close endfunc -func Test_cindent_2() +func Test_cindent_02() new setl cindent ts=4 sw=4 setl tw=0 noai fo=croq @@ -2192,7 +2192,7 @@ func Test_cindent_2() enew! | close endfunc -func Test_cindent_3() +func Test_cindent_03() new setl nocindent ts=4 sw=4 @@ -2252,7 +2252,7 @@ func Test_cindent_3() enew! | close endfunc -func Test_cindent_4() +func Test_cindent_04() new setl cindent ts=4 sw=4 @@ -2282,7 +2282,7 @@ func Test_cindent_4() enew! | close endfunc -func Test_cindent_5() +func Test_cindent_05() new setl cindent ts=4 sw=4 setl cino=}4 @@ -2332,7 +2332,7 @@ func Test_cindent_5() enew! | close endfunc -func Test_cindent_6() +func Test_cindent_06() new setl cindent ts=4 sw=4 setl cino=(0,)20 @@ -2395,7 +2395,7 @@ func Test_cindent_6() enew! | close endfunc -func Test_cindent_7() +func Test_cindent_07() new setl cindent ts=4 sw=4 setl cino=es,n0s @@ -2436,7 +2436,7 @@ func Test_cindent_7() enew! | close endfunc -func Test_cindent_8() +func Test_cindent_08() new setl cindent ts=4 sw=4 setl cino= @@ -2484,7 +2484,7 @@ func Test_cindent_8() enew! | close endfunc -func Test_cindent_9() +func Test_cindent_09() new setl cindent ts=4 sw=4 From cf68c82598f02484048eb6ac299f0b961596c591 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 16 Feb 2026 08:24:19 +0800 Subject: [PATCH 3/3] test(old): restore test coverage for invalid 'statusline' flag --- test/old/testdir/gen_opt_test.vim | 4 ++-- test/old/testdir/test_options.vim | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/old/testdir/gen_opt_test.vim b/test/old/testdir/gen_opt_test.vim index 7d1969e43d..85afac7fc2 100644 --- a/test/old/testdir/gen_opt_test.vim +++ b/test/old/testdir/gen_opt_test.vim @@ -336,13 +336,13 @@ let test_values = { \ 'timeout:-1', 'file:/tmp/file', 'expr:Func()', 'double,33'], \ ['xxx', '-1', 'timeout:', 'best,double', 'double,fast']], \ 'splitkeep': [['cursor', 'screen', 'topline'], ['xxx']], - \ 'statusline': [['', 'xxx'], ['%{', '%{%', '%{%}', '%(', '%)']], + \ 'statusline': [['', 'xxx'], ['%^', '%{', '%{%', '%{%}', '%(', '%)']], "\ 'swapsync': [['', 'sync', 'fsync'], ['xxx']], \ 'switchbuf': [['', 'useopen', 'usetab', 'split', 'vsplit', 'newtab', \ 'uselast', 'split,newtab'], \ ['xxx']], \ 'tabclose': [['', 'left', 'uselast', 'left,uselast'], ['xxx']], - \ 'tabline': [['', 'xxx'], ['%{', '%{%', '%{%}', '%(', '%)']], + \ 'tabline': [['', 'xxx'], ['%^', '%{', '%{%', '%{%}', '%(', '%)']], \ 'tagcase': [['followic', 'followscs', 'ignore', 'match', 'smart'], \ ['', 'xxx', 'smart,match']], \ 'termencoding': [has('gui_gtk') ? [] : ['', 'utf-8'], ['xxx']], diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim index e7dbd56e64..a722e872e1 100644 --- a/test/old/testdir/test_options.vim +++ b/test/old/testdir/test_options.vim @@ -866,6 +866,7 @@ func Test_set_option_errors() call assert_fails('set rulerformat=%15(%%', 'E542:') " Test for 'statusline' errors + call assert_fails('set statusline=%^', 'E539:') " Nvim: supports %$ call assert_fails('set statusline=%{', 'E540:') call assert_fails('set statusline=%{%', 'E540:') call assert_fails('set statusline=%{%}', 'E539:') @@ -873,6 +874,7 @@ func Test_set_option_errors() call assert_fails('set statusline=%)', 'E542:') " Test for 'tabline' errors + call assert_fails('set tabline=%^', 'E539:') " Nvim: supports %$ call assert_fails('set tabline=%{', 'E540:') call assert_fails('set tabline=%{%', 'E540:') call assert_fails('set tabline=%{%}', 'E539:')