vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636)

Problem:  missing change from patch v9.1.0754
Solution: use correct width for the actual item
          in pum_redraw() (glepnir)

closes: vim/vim#15786

a6d9e3c4e0
This commit is contained in:
glepnir 2024-10-03 17:58:15 +08:00 committed by GitHub
parent ae0e4071a8
commit cc300e553b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 2 deletions

View File

@ -764,7 +764,7 @@ void pum_redraw(void)
// Stop when there is nothing more to display. // Stop when there is nothing more to display.
if ((j == 2) if ((j == 2)
|| (next_isempty && (j == 1 || (j == 0 && pum_get_item(idx, order[j + 2]) == NULL))) || (next_isempty && (j == 1 || (j == 0 && pum_get_item(idx, order[j + 2]) == NULL)))
|| (pum_base_width + n >= pum_width)) { || (basic_width + n >= pum_width)) {
break; break;
} }

View File

@ -5077,6 +5077,17 @@ describe('builtin popupmenu', function()
\ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, \ { 'word': '你好', 'kind': 'C', 'menu': '中文' },
\]} \]}
endfunc endfunc
func Omni_long(findstart, base)
if a:findstart
return col(".")
endif
return {
\ 'words': [
\ { 'word': 'loooong_foo', 'kind': 'S', 'menu': 'menu' },
\ { 'word': 'loooong_bar', 'kind': 'T', 'menu': 'menu' },
\]}
endfunc
set omnifunc=Omni_test set omnifunc=Omni_test
]]) ]])
-- T1 -- T1
@ -5162,6 +5173,20 @@ describe('builtin popupmenu', function()
{1:~ }|*10 {1:~ }|*10
{2:-- }{5:match 1 of 3} | {2:-- }{5:match 1 of 3} |
]]) ]])
feed('<C-E><ESC>')
-- Test_pum_completeitemalign_07
command('set cia=menu,kind,abbr columns=12 cmdheight=2 omnifunc=Omni_long')
feed('S<C-X><C-O>')
screen:expect([[
loooong_foo^ |
{s:menu S loooo}|
{n:menu T loooo}|
{1:~ }|*10
|
{2:--} |
]])
feed('<C-E><ESC>')
end) end)
end end
end end

View File

@ -1597,6 +1597,17 @@ func Test_pum_completeitemalign()
\ { 'word': '你好', 'kind': 'C', 'menu': '中文' }, \ { 'word': '你好', 'kind': 'C', 'menu': '中文' },
\]} \]}
endfunc endfunc
func Omni_long(findstart, base)
if a:findstart
return col(".")
endif
return {
\ 'words': [
\ { 'word': 'loooong_foo', 'kind': 'S', 'menu': 'menu' },
\ { 'word': 'loooong_bar', 'kind': 'T', 'menu': 'menu' },
\]}
endfunc
set omnifunc=Omni_test set omnifunc=Omni_test
command! -nargs=0 T1 set cia=abbr,kind,menu command! -nargs=0 T1 set cia=abbr,kind,menu
command! -nargs=0 T2 set cia=abbr,menu,kind command! -nargs=0 T2 set cia=abbr,menu,kind
@ -1638,8 +1649,11 @@ func Test_pum_completeitemalign()
" T6 " T6
call term_sendkeys(buf, ":T6\<CR>S\<C-X>\<C-O>") call term_sendkeys(buf, ":T6\<CR>S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {}) call VerifyScreenDump(buf, 'Test_pum_completeitemalign_06', {})
call term_sendkeys(buf, "\<C-E>\<Esc>:T7\<CR>") call term_sendkeys(buf, "\<C-E>\<Esc>")
call term_sendkeys(buf, ":set columns=12 cmdheight=2 omnifunc=Omni_long\<CR>S\<C-X>\<C-O>")
call VerifyScreenDump(buf, 'Test_pum_completeitemalign_07', {})
call term_sendkeys(buf, "\<C-E>\<Esc>:T7\<CR>")
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc