0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

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.erkkila@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Anttoni Erkkilä 2025-03-09 16:07:15 +01:00 committed by Christian Brabandt
parent ccf2731fd1
commit f4d87ff888
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 21 additions and 1 deletions

View File

@ -405,7 +405,12 @@ cin_islabel_skip(char_u **s)
return FALSE; return FALSE;
while (vim_isIDc(**s)) while (vim_isIDc(**s))
{
if (has_mbyte)
(*s) += (*mb_ptr2len)(*s);
else
(*s)++; (*s)++;
}
*s = cin_skipcomment(*s); *s = cin_skipcomment(*s);

View File

@ -109,6 +109,19 @@ func Test_preproc_indent()
close! close!
endfunc 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' " Test for 'copyindent'
func Test_copyindent() func Test_copyindent()
new new

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1190,
/**/ /**/
1189, 1189,
/**/ /**/