patch 9.1.1190: C indentation does not detect multibyte labels Commit: https://github.com/vim/vim/commit/f4d87ff8883e5076633ef0ab0cf4d6e4beaddc5c Author: Anttoni Erkkilä <anttoni.erkk...@protonmail.com> Date: Sun Mar 9 16:07:15 2025 +0100
patch 9.1.1190: C indentation does not detect multibyte labels Problem: C indentation does not detect multibyte labels Solution: Correctly skip over multibyte characters (Anttoni Erkkilä) closes: #16770 Signed-off-by: Anttoni Erkkilä <anttoni.erkk...@protonmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/cindent.c b/src/cindent.c index cf18441f6..2414b3fad 100644 --- a/src/cindent.c +++ b/src/cindent.c @@ -405,7 +405,12 @@ cin_islabel_skip(char_u **s) return FALSE; while (vim_isIDc(**s)) - (*s)++; + { + if (has_mbyte) + (*s) += (*mb_ptr2len)(*s); + else + (*s)++; + } *s = cin_skipcomment(*s); diff --git a/src/testdir/test_indent.vim b/src/testdir/test_indent.vim index 0f0f9da8b..57f5206e7 100644 --- a/src/testdir/test_indent.vim +++ b/src/testdir/test_indent.vim @@ -109,6 +109,19 @@ func Test_preproc_indent() close! endfunc +func Test_userlabel_indent() + new + call setline(1, ['{', 'label:']) + normal GV= + call assert_equal('label:', getline(2)) + + call setline(2, 'läbél:') + normal GV= + call assert_equal('läbél:', getline(2)) + + close! +endfunc + " Test for 'copyindent' func Test_copyindent() new diff --git a/src/version.c b/src/version.c index af03cd9dd..fa05cd174 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1190, /**/ 1189, /**/ -- -- 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/E1trIMr-000I40-3h%40256bit.org.