-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Feat: Add border for popup menu ('pumborder' option) #18486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR introduces a new global option, `'pumborder'` (`'pb'`), that allows
users to define borders and optional decorations for the completion popup
menu.
```
*'pumborder'* *'pb'*
'pumborder' 'pb' number (default 0)
global
Defines a border and optional decorations for the popup menu in
completion. The value is a comma-separated list of keywords.
Border styles (at most one):
"single" use thin box-drawing characters
"double" use double-line box-drawing characters
"round" use rounded corners
"ascii" use ASCII characters (-, |, +)
"custom:XXXXXXXX"
use eight characters given after "custom:",
in order: top, right, bottom, left,
topleft, topright, botright, botleft
Additional flags:
"margin" adds one-cell spacing inside the left and right border
"shadow" draws a shadow at the right and bottom edges
Highlight groups:
|hl-PmenuBorder| used for the border characters
|hl-PmenuShadow| used for the shadow
Examples: >
:set pumborder=single
:set pumborder=double,margin,shadow
:set pumborder=custom:─│─│┌┐┘└,shadow
<
Border styles using box-drawing characters ("single", "double",
"round") are only available when |'encoding'| is "utf-8" and
|'ambiwidth'| is "single". "margin" requires a border style.
See also: |ins-completion-menu|.
```
Also, fixes vim#18441 (comment)
M ci/hlgroups.ignore
M src/optionstr.c
|
So this is essentially the same as #17091 ? |
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new global option 'pumborder' ('pb') that allows users to define borders and optional decorations for the completion popup menu. This enhancement provides visual improvements to the popup menu by adding customizable borders, margins, and shadows.
- Adds the
'pumborder'option with support for different border styles (single, double, round, ascii, custom) - Implements margin and shadow features for the popup menu
- Adds new highlight groups
PmenuBorderandPmenuShadowfor customization
Reviewed Changes
Copilot reviewed 73 out of 73 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vim.h | Adds new highlight group constants for popup menu border and shadow |
| src/popupmenu.c | Core implementation of border drawing, shadow effects, and popup positioning logic |
| src/optionstr.c | Handles parsing and validation of the pumborder option |
| src/optiondefs.h | Defines the new pumborder option in the options table |
| src/option.h | Declares the global variable for the pumborder option |
| src/highlight.c | Sets up default highlight groups and color schemes for border and shadow |
| runtime/ files | Updates documentation, syntax highlighting, and option window support |
| src/testdir/ files | Adds comprehensive tests and screen dumps for the new functionality |
Comments suppressed due to low confidence (1)
src/popupmenu.c:211
- The condition changed from
width > p_pmwtowidth >= p_pmw. This means when width equals p_pmw, it will now be truncated and end_padding disabled. This could be a subtle behavior change that affects popup menu rendering. Verify this change is intentional and doesn't break existing functionality.
if (p_pmw > 0 && width >= p_pmw)
{
width = p_pmw;
end_padding = FALSE;
}
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Does this also apply to popups or do you plan to make use of it for popups? |
popupwin.c (used by plugins and info window) already has border. Only popupmenu.c didn't have border, and now it does. |
|
thanks |
Problem: not possible to style popup borders globally
Solution: Add the 'pumborder' option (Girish Palya)
This commit introduces a new global option, 'pumborder' ('pb'), that
allows users to define borders and optional decorations for the
completion popup menu.
```
Defines a border and optional decorations for the popup menu in
completion. The value is a comma-separated list of keywords.
Border styles (at most one):
"single"singleuse thin box-drawing characters
"double"doubleuse double-line box-drawing characters
"round"rounduse rounded corners
"ascii"asciiuse ASCII characters (-, |, +)
"custom:XXXXXXXX"
use eight characters given after "custom:",
in order: top, right, bottom, left,
topleft, topright, botright, botleft
Additional flags:
"margin"marginadds one-cell spacing inside the left and right border
"shadow"shadowdraws a shadow at the right and bottom edges
Highlight groups:
|hl-PmenuBorder|hl-PmenuBorderused for the border characters
|hl-PmenuShadow|hl-PmenuShadowused for the shadow
Examples: >
:set pumborder=single
:set pumborder=double,margin,shadow
:set pumborder=custom:─│─│┌┐┘└,shadow
Border styles using box-drawing characters ("single", "double",
"round") are only available when |'encoding'| is "utf-8" and
|'ambiwidth'| is "single". "margin" requires a border style.
See also: |ins-completion-menu|.
```
fixes: vim#18441 (comment)
closes: vim#18486
closes: vim#17091
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
Thanks |
|
@zeertzjq any reason why this is not merged into Neovim? |
|
A part of it is merged (some of the 'pumborder' values works), but due to the presence of the existing 'winborder' option there are some differences, and I haven't figured out how to merged the remaining part yet. |
|
Thanks, I guess I was using the older version of Neovim. Your shadow implementation does not look right though (on the side it is only half as wide as the bottom), and underlying text is invisible unlike Vim which has some transparency. Option values cannot be combined either. Anyway, just nitpicking. |



This PR introduces a new global option,
'pumborder'('pb'), that allowsusers to define borders and optional decorations for the completion popup
menu.
Also, fixes #18441 (comment)