Skip to content

Commit 196a1f7

Browse files
committed
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)
1 parent c5cf369 commit 196a1f7

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/screen.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,13 @@ fill_foldcolumn(
295295
if (closed)
296296
{
297297
if (symbol != 0)
298-
// rollback length
298+
{
299+
// rollback length and the character
299300
byte_counter -= len;
301+
if (len > 1)
302+
// for a multibyte character, erase all the bytes
303+
vim_memset(p + byte_counter, ' ', len);
304+
}
300305
symbol = fill_foldclosed;
301306
len = utf_char2bytes(symbol, &p[byte_counter]);
302307
byte_counter += len;

src/testdir/test_fold.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,12 @@ func Test_foldcolumn_multibyte_char()
10611061
set fillchars+=foldopen:▾,foldsep:│,foldclose:▸
10621062
call s:mbyte_fillchar_tests('', '', '')
10631063

1064+
" Use a mix of multi-byte and single-byte characters
1065+
set fillchars+=foldopen:¬,foldsep:\|,foldclose:+
1066+
call s:mbyte_fillchar_tests('¬', '+', '|')
1067+
set fillchars+=foldopen:+,foldsep:\|,foldclose
1068+
call s:mbyte_fillchar_tests('+', '¬', '|')
1069+
10641070
bw!
10651071
set foldenable& fdc& fdm& fillchars&
10661072
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2633,
753755
/**/
754756
2632,
755757
/**/

0 commit comments

Comments
 (0)