From: Bram Moolenaar Date: Sun, 21 Mar 2021 13:39:19 +0000 (+0100) Subject: patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly X-Git-Tag: v8.2.2633 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=196a1f740981e878091fa124a400d1fc4bfa2bb0;p=vim patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly Problem: Multi-byte 'fillchars' for folding do not show properly. Solution: Handle multi-byte characters correctly. (Yegappan Lakshmanan, closes #7983, closes #7955) --- diff --git a/src/screen.c b/src/screen.c index 84951c5cc..d219b13c3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -295,8 +295,13 @@ fill_foldcolumn( if (closed) { if (symbol != 0) - // rollback length + { + // rollback length and the character byte_counter -= len; + if (len > 1) + // for a multibyte character, erase all the bytes + vim_memset(p + byte_counter, ' ', len); + } symbol = fill_foldclosed; len = utf_char2bytes(symbol, &p[byte_counter]); byte_counter += len; diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim index d451b1eb4..a032f4536 100644 --- a/src/testdir/test_fold.vim +++ b/src/testdir/test_fold.vim @@ -1061,6 +1061,12 @@ func Test_foldcolumn_multibyte_char() set fillchars+=foldopen:▾,foldsep:│,foldclose:▸ call s:mbyte_fillchar_tests('▾', '▸', '│') + " Use a mix of multi-byte and single-byte characters + set fillchars+=foldopen:¬,foldsep:\|,foldclose:+ + call s:mbyte_fillchar_tests('¬', '+', '|') + set fillchars+=foldopen:+,foldsep:\|,foldclose:¬ + call s:mbyte_fillchar_tests('+', '¬', '|') + bw! set foldenable& fdc& fdm& fillchars& endfunc diff --git a/src/version.c b/src/version.c index be2c759d9..350f0a133 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2633, /**/ 2632, /**/