From afca5b564e766a2ba1049c52e6e4e04d82a09388 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 16 Apr 2025 07:49:16 +0800 Subject: [PATCH] vim-patch:9.1.1309: tests: no test for 'pummaxwidth' with non-truncated "kind" Problem: tests: no test for 'pummaxwidth' with non-truncated "kind". Solution: Add a test with "kind" and larger 'pummaxwidth' (zeertzjq). closes: vim/vim#17126 https://github.com/vim/vim/commit/031919c7ac66c4fcff3719b4f4158887b68d3315 --- test/functional/ui/popupmenu_spec.lua | 65 +++++++++++++++++++++++++++ test/old/testdir/test_popup.vim | 14 ++++++ 2 files changed, 79 insertions(+) diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index e910cb7d8e..ec0d0c6266 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -6334,6 +6334,71 @@ describe('builtin popupmenu', function() end feed('') command('set norightleft') + + command('set pummaxwidth=16') + feed('S') + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:--------------------------------]|*19 + [3:--------------------------------]| + ## grid 2 + foo^ | + {1:~ }|*18 + ## grid 3 + {2:-- }{5:match 1 of 3} | + ## grid 4 + {s:foo fooK>}| + {n:bar 一二>}| + {n:一二三四五 multi}| + ]], + float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } }, + }) + else + screen:expect([[ + foo^ | + {s:foo fooK>}{1: }| + {n:bar 一二>}{1: }| + {n:一二三四五 multi}{1: }| + {1:~ }|*15 + {2:-- }{5:match 1 of 3} | + ]]) + end + feed('') + + command('set rightleft') + feed('S') + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:--------------------------------]|*19 + [3:--------------------------------]| + ## grid 2 + ^ oof| + {1: ~}|*18 + ## grid 3 + {2:-- }{5:match 1 of 3} | + ## grid 4 + {s:') + command('set norightleft') end) it('does not crash when displayed in last column with rightleft #12032', function() diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index bc727d1b0a..8f65d768ce 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -2160,6 +2160,20 @@ func Test_pum_maxwidth_multibyte() call term_sendkeys(buf, "\:set norightleft\") endif + call term_sendkeys(buf, ":set pummaxwidth=16\") + call TermWait(buf, 50) + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_21', {'rows': 8}) + call term_sendkeys(buf, "\") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call TermWait(buf, 50) + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_22', {'rows': 8}) + call term_sendkeys(buf, "\:set norightleft\") + endif + call StopVimInTerminal(buf) endfunc