To: vim_dev@googlegroups.com Subject: Patch 8.2.2633 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2633 Problem: Multi-byte 'fillchars' for folding do not show properly. Solution: Handle multi-byte characters correctly. (Yegappan Lakshmanan, closes #7983, closes #7955) Files: src/screen.c, src/testdir/test_fold.vim *** ../vim-8.2.2632/src/screen.c 2021-03-04 21:55:54.601235264 +0100 --- src/screen.c 2021-03-21 14:38:06.039333810 +0100 *************** *** 295,302 **** if (closed) { if (symbol != 0) ! // rollback length byte_counter -= len; symbol = fill_foldclosed; len = utf_char2bytes(symbol, &p[byte_counter]); byte_counter += len; --- 295,307 ---- if (closed) { if (symbol != 0) ! { ! // 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; *** ../vim-8.2.2632/src/testdir/test_fold.vim 2021-03-04 21:55:54.601235264 +0100 --- src/testdir/test_fold.vim 2021-03-21 14:34:42.759858939 +0100 *************** *** 1061,1066 **** --- 1061,1072 ---- 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 *** ../vim-8.2.2632/src/version.c 2021-03-20 22:16:52.961362692 +0100 --- src/version.c 2021-03-21 14:37:24.163439263 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2633, /**/ -- The goal of science is to build better mousetraps. The goal of nature is to build better mice. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///