0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.2.3846: no error when using control character for 'lcs' or 'fcs'

Problem:    No error when using control character for 'lcs' or 'fcs'.
Solution:   Use char2cells() to check the width. (closes #9369)
This commit is contained in:
zeertzjq
2021-12-18 15:32:46 +00:00
committed by Bram Moolenaar
parent 0dc4d8eaec
commit 60618c8f1a
4 changed files with 23 additions and 5 deletions

View File

@@ -4914,19 +4914,19 @@ set_chars_option(win_T *wp, char_u **varp)
c2 = c3 = 0;
s = p + len + 1;
c1 = get_encoded_char_adv(&s);
if (mb_char2cells(c1) > 1)
if (char2cells(c1) > 1)
return e_invarg;
if (tab[i].cp == &lcs_chars.tab2)
{
if (*s == NUL)
return e_invarg;
c2 = get_encoded_char_adv(&s);
if (mb_char2cells(c2) > 1)
if (char2cells(c2) > 1)
return e_invarg;
if (!(*s == ',' || *s == NUL))
{
c3 = get_encoded_char_adv(&s);
if (mb_char2cells(c3) > 1)
if (char2cells(c3) > 1)
return e_invarg;
}
}
@@ -4968,7 +4968,7 @@ set_chars_option(win_T *wp, char_u **varp)
while (*s != NUL && *s != ',')
{
c1 = get_encoded_char_adv(&s);
if (mb_char2cells(c1) > 1)
if (char2cells(c1) > 1)
return e_invarg;
++multispace_len;
}