]> granicus.if.org Git - vim/commitdiff
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly v8.2.2633
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Mar 2021 13:39:19 +0000 (14:39 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Mar 2021 13:39:19 +0000 (14:39 +0100)
Problem:    Multi-byte 'fillchars' for folding do not show properly.
Solution:   Handle multi-byte characters correctly. (Yegappan Lakshmanan,
            closes #7983, closes #7955)

src/screen.c
src/testdir/test_fold.vim
src/version.c

index 84951c5cc65442b764cbaaa729e4e581028f86f6..d219b13c38330b5a4772cf0ad7e4c851e62b562f 100644 (file)
@@ -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;
index d451b1eb495c7f105acc4a280f10a10a8d1558ce..a032f4536ee5e324f2315359340e28f64a1a0487 100644 (file)
@@ -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
index be2c759d99fa5b4875602f7cfe5d5a77d63daa21..350f0a13341f757ad1b0319a52a609112b69e999 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2633,
 /**/
     2632,
 /**/