patch 9.1.1398: completion: trunc does not follow Pmenu highlighting attributes

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: #17340

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/dumps/Test_pum_maxwidth_23.dump b/src/testdir/dumps/Test_pum_maxwidth_23.dump
new file mode 100644
index 0000000..aa8fafa
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_maxwidth_23.dump
@@ -0,0 +1,8 @@
+|一*0&#ffffff0|二|三|四|五|六|七|八|九|十> +&@54
+|一*0#ff404010#e0e0e08|二|三|四|五|六|七| +&|>+0#0000001&| +0#4040ff13#ffffff0@58
+|1+0#ff404010#ffd7ff255|2|3|4|5|6|7|8|9|_|1|2|3|4|5|>+0#0000001&| +0#4040ff13#ffffff0@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index f1fc960..1fd18ca 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -2030,6 +2030,7 @@
   CheckScreendump
 
   let lines =<< trim END
+    hi StrikeFake ctermfg=9
     let g:change = 0
     func Omni_test(findstart, base)
       if a:findstart
@@ -2054,8 +2055,14 @@
           \ #{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
@@ -2168,6 +2175,12 @@
     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