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:
zeertzjq
2025-05-19 08:11:54 +08:00
committed by GitHub
parent 3a35fdc347
commit dc6885dc24
3 changed files with 57 additions and 3 deletions

View File

@@ -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