aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-29 06:35:11 +0800
committerzeertzjq <zeertzjq@outlook.com>2025-03-29 21:12:32 +0800
commit675ee057e06578e8d87ed2ea54ab8915caecdb0f (patch)
tree652087e5734b27f4c240be000d25f98fec4f6834
parent62da4e2949cc906102bd768cdd40b274623822b6 (diff)
downloadrneovim-675ee057e06578e8d87ed2ea54ab8915caecdb0f.tar.gz
rneovim-675ee057e06578e8d87ed2ea54ab8915caecdb0f.tar.bz2
rneovim-675ee057e06578e8d87ed2ea54ab8915caecdb0f.zip
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 <glephunter@gmail.com>
-rw-r--r--runtime/optwin.vim4
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--test/functional/ui/popupmenu_spec.lua36
-rw-r--r--test/old/testdir/test_popup.vim5
4 files changed, 45 insertions, 2 deletions
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 41f9fc0373..ce4590f01b 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2025 Mar 27
+" Last Change: 2025 Mar 28
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -736,7 +736,7 @@ if has("insert_expand")
call <SID>OptionG("ph", &ph)
call <SID>AddOption("pumwidth", gettext("minimum width of the popup menu"))
call <SID>OptionG("pw", &pw)
- call <SID>AddOption("pumaxmwidth", gettext("maximum width of the popup menu"))
+ call <SID>AddOption("pummaxwidth", gettext("maximum width of the popup menu"))
call <SID>OptionG("pmw", &pmw)
call <SID>AddOption("completefunc", gettext("user defined function for Insert mode completion"))
call append("$", "\t" .. s:local_to_buffer)
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 75f1c93ed7..4ce4f9632f 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -391,6 +391,8 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
if (p_pmw > 0 && pum_width > p_pmw) {
pum_width = (int)p_pmw;
}
+ } else if (p_pmw > 0 && pum_width > p_pmw) {
+ pum_width = (int)p_pmw;
}
}
} else if (max_col - min_col < def_width) {
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 7469269a1b..d82c24bb83 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -5621,6 +5621,42 @@ describe('builtin popupmenu', function()
]])
end
feed('<Esc>3Gdd"zp')
+
+ screen:try_resize(32, 10)
+ feed('GA<C-X><C-N>')
+ if multigrid then
+ screen:expect({
+ grid = [[
+ ## grid 1
+ [2:--------------------------------]|*9
+ [3:--------------------------------]|
+ ## grid 2
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_|
+ 123456789_a^ |
+ {1:~ }|*5
+ ## grid 3
+ {2:-- }{5:match 1 of 2} |
+ ## grid 4
+ {s: 12345...}|
+ {n: 12345...}|
+ ]],
+ float_pos = { [4] = { -1, 'NW', 2, 4, 11, false, 100 } },
+ })
+ else
+ screen:expect([[
+ 123456789_123456789_123456789_a |
+ 123456789_123456789_123456789_b |
+ 123456789_123456789_|
+ 123456789_a^ |
+ {1:~ }{s: 12345...}{1: }|
+ {1:~ }{n: 12345...}{1: }|
+ {1:~ }|*3
+ {2:-- }{5:match 1 of 2} |
+ ]])
+ end
+ feed('<Esc>3Gdd"zp')
end)
-- oldtest: Test_pum_maxwidth_multibyte()
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, "\<Esc>3Gdd\"zp")
+ call term_sendkeys(buf, ":set lines=10 columns=32\<CR>")
+ call term_sendkeys(buf, "GA\<C-N>")
+ call VerifyScreenDump(buf, 'Test_pum_maxwidth_09', {'rows': 10, 'cols': 32})
+ call term_sendkeys(buf, "\<Esc>3Gdd\"zp")
+
call StopVimInTerminal(buf)
endfunc