neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit c0b3f3b53282b27cbaf5aa66b917ba2bdf3cd492
parent 6342fc7dc8298b92edcb6dfeaa6a8af98142ecfe
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 24 Jan 2026 07:34:43 +0800

Merge pull request #37520 from zeertzjq/vim-9.1.2102

vim-patch:9.1.{2102,2103,2108}
Diffstat:
Mtest/functional/legacy/fold_spec.lua | 28++++++++++++++++++++++++++++
Mtest/functional/ui/fold_spec.lua | 1-
Mtest/old/testdir/test_fold.vim | 52+++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/test/functional/legacy/fold_spec.lua b/test/functional/legacy/fold_spec.lua @@ -296,4 +296,32 @@ describe('folding', function() | ]]) end) + + -- oldtest: Test_foldtext_and_fillchars_rightleft() + it("fold text is displayed properly with 'rightleft'", function() + screen:try_resize(70, 5) + exec([[ + let longtext = 'Lorem ipsum dolor sit amet, consectetur adipiscing' + let g:multibyte = 'Lorem ipsum dolor sit amet' + + call setline(1, [longtext, longtext, longtext]) + 1,2fold + + setlocal rightleft + set noshowmode noshowcmd + ]]) + screen:expect([[ + {13:······gnicsipida rutetcesnoc ,tema tis rolod muspi meroL :senil 2 --^+}| + gnicsipida rutetcesnoc ,tema tis rolod muspi meroL| + {1: ~}|*2 + | + ]]) + command('call setline(1, [g:multibyte, g:multibyte, g:multibyte])') + screen:expect([[ + {13:········tema tis rolod muspi meroL :senil 2 -^-+}| + tema tis rolod muspi meroL| + {1: ~}|*2 + | + ]]) + end) end) diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua @@ -1079,7 +1079,6 @@ describe('folded lines', function() ]]) end - -- Note: too much of the folded line gets cut off.This is a vim bug. feed_command('set rightleft') if multigrid then screen:expect([[ diff --git a/test/old/testdir/test_fold.vim b/test/old/testdir/test_fold.vim @@ -1097,7 +1097,7 @@ func Test_fold_expr_error() endfor set foldmethod& foldexpr& - close! + bw! endfunc func Test_undo_fold_deletion() @@ -1303,6 +1303,56 @@ func Test_foldtextresult() bw! endfunc +" Test for foldtext and fillchars with 'rightleft' enabled +func Test_foldtext_and_fillchars_rightleft() + CheckFeature rightleft + CheckScreendump + CheckRunVimInTerminal + + let script_lines =<< trim END + let longtext = 'Lorem ipsum dolor sit amet, consectetur adipiscing' + let g:multibyte = 'Lorem ipsum dolor sit amet' + + call setline(1, [longtext, longtext, longtext]) + 1,2fold + + setlocal rightleft + set noshowmode noshowcmd + END + call writefile(script_lines, 'XTest_foldtext_and_fillchars_rightleft', 'D') + let buf = RunVimInTerminal('-S XTest_foldtext_and_fillchars_rightleft', {'rows': 5, 'cols': 70}) + + call VerifyScreenDump(buf, 'Test_foldtext_and_fillchars_rightleft_01', {}) + call term_sendkeys(buf, ":call setline(1, [g:multibyte, g:multibyte, g:multibyte])\<CR>") + call VerifyScreenDump(buf, 'Test_foldtext_and_fillchars_rightleft_02', {}) + + " clean up + call StopVimInTerminal(buf) +endfunc + +" Test for foldtextresult() with 'rightleft' enabled +func Test_foldtextresult_rightleft() + CheckFeature rightleft + + let save_columns = &columns + new + set columns=70 + setlocal rightleft + + let longtext = 'Lorem ipsum dolor sit amet, consectetur adipiscing' + let multibyte = 'Lorem ipsum dolor sit amet' + + call setline(1, [longtext, longtext, longtext]) + 1,2fold + call assert_equal('+-- 2 lines: ' .. longtext, foldtextresult(1)) + + call setline(1, [multibyte, multibyte, multibyte]) + call assert_equal('+-- 2 lines: ' .. multibyte, foldtextresult(1)) + + bw! + let &columns = save_columns +endfunc + " Test for merging two recursive folds when an intermediate line with no fold " is removed func Test_fold_merge_recursive()