From 62da4e2949cc906102bd768cdd40b274623822b6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 28 Mar 2025 15:37:49 +0800 Subject: vim-patch:9.1.1250: cannot set the maximum popup menu width Problem: cannot set the maximum popup menu width (Lucas Mior) Solution: add the new global option value 'pummaxwidth' (glepnir) fixes: vim/vim#10901 closes: vim/vim#16943 https://github.com/vim/vim/commit/88d75934c3d5bc4c406343f106e1a61638abd3a7 Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'test/old') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 8f81db6213..631a81d5cc 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -1992,4 +1992,81 @@ func Test_pum_complete_with_special_characters() call StopVimInTerminal(buf) endfunc +func Test_pum_maxwidth() + CheckScreendump + + let lines =<< trim END + 123456789_123456789_123456789_a + 123456789_123456789_123456789_b + 123 + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('Xtest', {}) + + call term_sendkeys(buf, "G\"zyy") + call term_sendkeys(buf, "A\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_01', {'rows': 8}) + call term_sendkeys(buf, "\3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=10\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_02', {'rows': 8}) + call term_sendkeys(buf, "\3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=20\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_03', {'rows': 8}) + call term_sendkeys(buf, "\3Gdd\"zp") + + call term_sendkeys(buf, ":set pumwidth=20 pummaxwidth=8\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_04', {'rows': 8}) + call term_sendkeys(buf, "\3Gdd\"zp") + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_maxwidth_multibyte() + CheckScreendump + + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [ + \ #{word: "123456789_123456789_123456789_"}, + \ #{word: "一二三四五六七八九十"}, + \ ] + endfunc + set omnifunc=Omni_test + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('-S Xtest', {}) + call TermWait(buf) + + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_05', {'rows': 8}) + call term_sendkeys(buf, "\") + + call term_sendkeys(buf, ":set pummaxwidth=10\") + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_06', {'rows': 8}) + call term_sendkeys(buf, "\") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\") + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_07', {'rows': 8}) + call term_sendkeys(buf, "\:set norightleft\") + endif + + call term_sendkeys(buf, ":set pummaxwidth=2\") + call term_sendkeys(buf, "S\\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_08', {'rows': 8}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 675ee057e06578e8d87ed2ea54ab8915caecdb0f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 29 Mar 2025 06:35:11 +0800 Subject: vim-patch:9.1.1255: missing test condition for 'pummaxwidth' setting Problem: missing test condition for 'pummaxwidth' setting, pummaxwidth not effective when width is 32 and height is 10 (after v9.1.1250) Solution: add missing comparison condition in pum_width() (glepnir) closes: vim/vim#16999 https://github.com/vim/vim/commit/532c5aec6fa8f0a3d743c7d1573d25d75dd36d5f Co-authored-by: glepnir --- test/old/testdir/test_popup.vim | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/old') diff --git a/test/old/testdir/test_popup.vim b/test/old/testdir/test_popup.vim index 631a81d5cc..94e437ee93 100644 --- a/test/old/testdir/test_popup.vim +++ b/test/old/testdir/test_popup.vim @@ -2023,6 +2023,11 @@ func Test_pum_maxwidth() call VerifyScreenDump(buf, 'Test_pum_maxwidth_04', {'rows': 8}) call term_sendkeys(buf, "\3Gdd\"zp") + call term_sendkeys(buf, ":set lines=10 columns=32\") + call term_sendkeys(buf, "GA\") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_09', {'rows': 10, 'cols': 32}) + call term_sendkeys(buf, "\3Gdd\"zp") + call StopVimInTerminal(buf) endfunc -- cgit