Skip to content

Conversation

@glepnir
Copy link
Member

@glepnir glepnir commented Apr 10, 2025

set pumborder=rounded hi PmenuBorder ctermfg=blue ctermbg=NONE

image

set pumborder=+,-,+,\|,+,-,+,\|

image

set wildoptions=pum

image

@glepnir glepnir marked this pull request as draft April 10, 2025 12:44
@chrisbra
Copy link
Member

Thanks, that looks nice. However this:

set pumborder=rounded
or
set pumborder=+,-,+,|,+,-,+,|

That looks inconsistent (using a single word vs. several single characters). Also I think would make sense to model it after the popup borderchars option (for popups). We could then later re-use this option for the popup borders as well, so perhaps call it just borderchars option then.

@girishji
Copy link
Contributor

girishji commented Apr 11, 2025

The right border wall should be shifted one cell to the right, placing the scrollbar inside the border—consistent with the behavior of popup_create(). In fact, all other aspects should align with popup_create(), including support for border, padding, borderchars, borderhighlight, and so on. There’s no justification for introducing inconsistent/confusing special case UI like "rounded". Instead use borderchars as intended.

@glepnir
Copy link
Member Author

glepnir commented Apr 11, 2025

That looks inconsistent (using a single word vs. several single characters)

single word is some built-in border types. Neovim has some built-in border types. This provides some convenience, borderchar is not easy to port to neovim. I implemented winborder option in neovim to set float window (vim is popup window) border, but it is only used for windows, not pum. Pum and popup are different things. Is it appropriate to use popup fields?

@zeertzjq
Copy link
Member

zeertzjq commented Apr 25, 2025

I think this feature is not worth adding. The code for computing popupmenu position and size is already quite complicated, and adding a border to the popupmenu will even further complicate the code and introduce more edge cases.

@glepnir
Copy link
Member Author

glepnir commented Apr 25, 2025

Not entirely correct. When the height is sufficient, we add an extra border. When the screen space is insufficient, the upper edge and width of the current pum are additionally occupied. code is not complicated

@zeertzjq
Copy link
Member

zeertzjq commented Apr 25, 2025

Also, mouse select position is currently off-by-one in right-click menu with 'pumborder' enabled:

source $VIMRUNTIME/menu.vim
set mousemodel=popup
set pumborder=rounded

@glepnir
Copy link
Member Author

glepnir commented Apr 25, 2025

fixed .

@chrisbra chrisbra closed this in 474b981 Oct 7, 2025
bennyyip pushed a commit to bennyyip/vim that referenced this pull request Oct 7, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants