mirror of
https://github.com/neovim/neovim.git
synced 2025-09-20 18:28:19 +00:00
vim-patch:9.1.1398: completion: trunc does not follow Pmenu highlighting attributes (#34084)
Problem: When items are combined with user-defined highlight attributes
(e.g., strikethrough), trunc inherits these attributes, making
the text difficult to read.
Solution: trunc now uses the original Pmenu and PmenuSel highlight
attributes (glepnir)
closes: vim/vim#17340
0816f17e9a
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -5810,6 +5810,7 @@ describe('builtin popupmenu', function()
|
||||
it("'pummaxwidth' with multibyte", function()
|
||||
screen:try_resize(60, 8)
|
||||
exec([[
|
||||
hi StrikeFake guifg=DarkRed
|
||||
let g:change = 0
|
||||
func Omni_test(findstart, base)
|
||||
if a:findstart
|
||||
@@ -5834,8 +5835,14 @@ describe('builtin popupmenu', function()
|
||||
\ #{word: "bar", menu: "fooMenu", kind: "一二三四"},
|
||||
\ #{word: "一二三四五", kind: "multi"},
|
||||
\ ]
|
||||
else
|
||||
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
|
||||
elseif g:change == 3
|
||||
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
|
||||
else
|
||||
return [
|
||||
\ #{word: "一二三四五六七八九十", abbr_hlgroup: "StrikeFake"},
|
||||
\ #{word: "123456789_123456789_123456789_", abbr_hlgroup: "StrikeFake"},
|
||||
\ ]
|
||||
endif
|
||||
endfunc
|
||||
set omnifunc=Omni_test
|
||||
@@ -6399,6 +6406,36 @@ describe('builtin popupmenu', function()
|
||||
end
|
||||
feed('<Esc>')
|
||||
command('set norightleft')
|
||||
|
||||
command('let g:change=4')
|
||||
feed('S<C-X><C-O>')
|
||||
if multigrid then
|
||||
screen:expect({
|
||||
grid = [[
|
||||
## grid 1
|
||||
[2:--------------------------------]|*19
|
||||
[3:--------------------------------]|
|
||||
## grid 2
|
||||
一二三四五六七八九十^ |
|
||||
{1:~ }|*18
|
||||
## grid 3
|
||||
{2:-- }{5:match 1 of 2} |
|
||||
## grid 4
|
||||
{ds:一二三四五六七 }{s:>}|
|
||||
{dn:123456789_12345}{n:>}|
|
||||
]],
|
||||
float_pos = { [4] = { -1, 'NW', 2, 1, 0, false, 100, 1, 1, 0 } },
|
||||
})
|
||||
else
|
||||
screen:expect([[
|
||||
一二三四五六七八九十^ |
|
||||
{ds:一二三四五六七 }{s:>}{1: }|
|
||||
{dn:123456789_12345}{n:>}{1: }|
|
||||
{1:~ }|*16
|
||||
{2:-- }{5:match 1 of 2} |
|
||||
]])
|
||||
end
|
||||
feed('<Esc>')
|
||||
end)
|
||||
|
||||
it('does not crash when displayed in last column with rightleft #12032', function()
|
||||
|
@@ -2036,6 +2036,7 @@ func Test_pum_maxwidth_multibyte()
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim END
|
||||
hi StrikeFake ctermfg=9
|
||||
let g:change = 0
|
||||
func Omni_test(findstart, base)
|
||||
if a:findstart
|
||||
@@ -2060,8 +2061,14 @@ func Test_pum_maxwidth_multibyte()
|
||||
\ #{word: "bar", menu: "fooMenu", kind: "一二三四"},
|
||||
\ #{word: "一二三四五", kind: "multi"},
|
||||
\ ]
|
||||
else
|
||||
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
|
||||
elseif g:change == 3
|
||||
return [#{word: "bar", menu: "fooMenu", kind: "一二三"}]
|
||||
else
|
||||
return [
|
||||
\ #{word: "一二三四五六七八九十", abbr_hlgroup: "StrikeFake"},
|
||||
\ #{word: "123456789_123456789_123456789_", abbr_hlgroup: "StrikeFake"},
|
||||
\ ]
|
||||
endif
|
||||
endfunc
|
||||
set omnifunc=Omni_test
|
||||
@@ -2174,6 +2181,12 @@ func Test_pum_maxwidth_multibyte()
|
||||
call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>")
|
||||
endif
|
||||
|
||||
call term_sendkeys(buf, ":let g:change=4\<CR>")
|
||||
call TermWait(buf, 50)
|
||||
call term_sendkeys(buf, "S\<C-X>\<C-O>")
|
||||
call VerifyScreenDump(buf, 'Test_pum_maxwidth_23', {'rows': 8})
|
||||
call term_sendkeys(buf, "\<ESC>")
|
||||
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
|
Reference in New Issue
Block a user