fix(ui): 'pumborder' parsing, shadow #36127

Problem:
1. Setting `pumborder=+,+,+,+,+,+,+,+` failed to render the custom
   border characters correctly. The issue occurred in `parse_winborder()`
   where it incorrectly used `p_winborder` instead of the `border_opt`
   parameter when the option value didn't contain commas.
2. In `pum_redraw()`, calling `parse_border_style()` directly with the
   option string failed to parse comma-separated border characters.
3. Missing documentation for PmenuShadow and PmenuShadowThrough
   highlight groups used by the shadow border style.
4. Coverity reports CID 631420: passing WinConfig (480 bytes) by value
   in `grid_draw_border()`.
5. crash when using `shadow` value on pumborder.

Solution:
1. Fix `parse_winborder()` to use `border_opt` parameter consistently,
   ensuring the correct option value is parsed regardless of which
   option (winborder/pumborder) is being set.
2. Update `pum_redraw()` to call `parse_winborder()` instead of
   `parse_border_style()`, properly handling both predefined styles
   and custom comma-separated border characters.
3. Add documentation for PmenuShadow (blended shadow areas) and
   PmenuShadowThrough (see-through corners) highlight groups.
4. Change `grid_draw_border()` to accept WinConfig by pointer.
5. When the "shadow" style is used, no additional row and column offset
   is applied, and the border width is reduced.
This commit is contained in:
glepnir
2025-10-12 10:48:27 +08:00
committed by GitHub
parent c7fd0c17b1
commit 072f126453
12 changed files with 169 additions and 29 deletions

View File

@@ -219,6 +219,7 @@ HIGHLIGHTS
• |hl-DiffTextAdd| highlights added text within a changed line.
• |hl-OkMsg| |hl-StderrMsg| |hl-StdoutMsg|
• |hl-SnippetTabstopActive| highlights the currently active tabstop.
• |hl-PmenuBorder |hl-PmenuShadow| |hl-PmenuShadowThrough| see 'pumborder'.
LSP
@@ -301,6 +302,7 @@ OPTIONS
• 'winborder' "bold" style, custom border style.
• |g:clipboard| accepts a string name to force any builtin clipboard tool.
• 'busy' sets a buffer "busy" status. Indicated in the default statusline.
• 'pumborder' add a border to the popup menu.
PERFORMANCE

View File

@@ -4912,7 +4912,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'pumborder' string (default "")
global
Defines the default border style of popupmenu windows. Same as
'winborder'.
'winborder'. |hl-PmenuBorder| is used. When style is "shadow", the
|hl-PmenuShadow| and |hl-PmenuShadowThrough| are used.
*'pumheight'* *'ph'*
'pumheight' 'ph' number (default 0)

View File

@@ -5354,6 +5354,11 @@ Normal Normal text.
NormalFloat Normal text in floating windows.
*hl-FloatBorder*
FloatBorder Border of floating windows.
*hl-FloatShadow*
FloatShadow Blended areas when border is shadow.
*hl-FLoatShadowThrough*
FloatShadownThrough
shadow corners when border is shadow.
*hl-FloatTitle*
FloatTitle Title of floating windows.
*hl-FloatFooter*
@@ -5382,6 +5387,13 @@ PmenuMatch Popup menu: Matched text in normal item. Combined with
*hl-PmenuMatchSel*
PmenuMatchSel Popup menu: Matched text in selected item. Combined with
|hl-PmenuMatch| and |hl-PmenuSel|.
*hl-PmenuBorder*
PmenuBorder Popup menu: border of popup menu.
*hl-PmenuShadow*
PmenuShadow Popup menu: blended areas when 'pumborder' is shadow.
*hl-PmenuShadowThrough*
PmenuShadownThrough
Popup menu: shadow corners when 'pumborder' is shadow.
*hl-ComplMatchIns*
ComplMatchIns Matched text of the currently inserted completion.
*hl-PreInsert*

View File

@@ -5130,7 +5130,8 @@ vim.go.pumblend = vim.o.pumblend
vim.go.pb = vim.go.pumblend
--- Defines the default border style of popupmenu windows. Same as
--- 'winborder'.
--- 'winborder'. `hl-PmenuBorder` is used. When style is "shadow", the
--- `hl-PmenuShadow` and `hl-PmenuShadowThrough` are used.
---
--- @type string
vim.o.pumborder = ""