Skip to content

Conversation

@girishji
Copy link
Contributor

@girishji girishji commented Oct 4, 2025

Pl. merge this after #18486.

This patch extends the 'completepopup' option with additional settings. Also, adds "shadow" effect to the info popup window.

New values:

	close		show close button: "on" (default) or "off"
	resize		show resize handle: "on" (default) or "off"
	borderchars	eight characters separated by semicolons, in the
		        order: top, right, bottom, left,
			    topleft, topright, botright, botleft.
	borderhighlight	highlight group of the popup border characters
	shadow		"off" (default) or "on" using |hl-PmenuShadow|

Edit:
New values:

'completepopup' 'cpp'	string (default empty)
			global
			{not available when compiled without the |+textprop|
			or |+quickfix| feature}
	When 'completeopt' contains "popup", this option specifies the
	properties of the info popup when it is created.  If an info popup
	window already exists it is closed, so that the option value is
	applied when it is created again.

	The option is a comma-separated list of values:
		height		maximum height of the popup
		width		maximum width of the popup
		highlight	highlight group of the popup (default is PmenuSel)
		align		"item" (default) or "menu"
		close		show close button: "on" (default) or "off"
		resize		show resize handle: "on" (default) or "off"
		border		border style:
				"single"	thin box-drawing characters
				"double"	double-line (default)
				"round"		rounded corners
				"ascii"		ASCII characters (-, |, +)
				"custom:X;X;X;X;X;X;X;X"
						eight characters separated by
						semicolons, in the order: top, right,
						bottom, left, topleft, topright,
						botright, botleft
				"off"		no border
		borderhighlight	highlight group for the popup border characters
		shadow		"off" (default) or "on" using |hl-PmenuShadow|

	Example: >
		:set completepopup=height:10,border:single,highlight:InfoPopup
		:set completepopup=width:60,border:custom:─;│;─;│;┌;┐;┘;└
<
	When "align" is set to "item", the popup is positioned near the
	selected item and moves as the selection changes.
	When set to "menu", the popup aligns with the top of the menu (if the
	menu appears below the text) or with the bottom (if it appears above).

	The close button and resize handle are shown on the popup border only
	when 'mouse' is enabled.

	After creation, the info popup can be located with |popup_findinfo()|
	and modified using |popup_setoptions()|.  See also: |complete-popup|.


This patch extends the 'completepopup' option with additional settings to
allow more configuration of info popup window.

New values:
```
- close           "on" (default) or "off"
- resize          "on" (default) or "off"
- borderchars     specify eight characters (separated by semicolons) to draw
                  the popup border: top, right, bottom, left, topleft,
                  topright, botright, botleft.
- borderhighlight highlight group for the popup border characters
- shadow          pum shadow
```
@habamax
Copy link
Contributor

habamax commented Oct 9, 2025

is it feasible to extend border too to have values similar to pumborder, e.g.

on/off as of now

plus the next implying on:

	"single"	use thin box-drawing characters
	"double"	use double-line box-drawing characters
	"round"		use rounded corners
	"ascii"		use ASCII characters (-, |, +)
	"custom:X;X;X;X;X;X;X;X"
			use eight characters separated by semicolons, in the
			order: top, right, bottom, left,
			topleft, topright, botright, botleft

here custom could be used instead of proposed borderchars.

@girishji
Copy link
Contributor Author

girishji commented Oct 9, 2025

You want to replace on and off with those values?

Or, make on=double but keep it hidden for backward compatibility.

@chrisbra
Copy link
Member

chrisbra commented Oct 9, 2025

I don't think this would work and I think it would break scripts that query the popup_getoptions() value (also the return value is strange according to the documentation). Instead perhaps use "borderstyle"?

@habamax
Copy link
Contributor

habamax commented Oct 9, 2025

Indeed, borderstyle sounds better.

@habamax
Copy link
Contributor

habamax commented Oct 9, 2025

You want to replace on and off with those values?

Or, make on=double but keep it hidden for backward compatibility.

I was about on being an alias of double, off is just off, and the rest is the additional values of border. With this it would have been backward compatible and aligned with pumborder.

M  runtime/doc/insert.txt
M  src/optionstr.c
M  src/popupwin.c
@girishji
Copy link
Contributor Author

Try now.

M  runtime/doc/insert.txt
M  runtime/doc/options.txt
@habamax
Copy link
Contributor

habamax commented Oct 12, 2025

Looks good, although I would have added on as an alias to/of double to the doc:

		border		border style:
				"single"	thin box-drawing characters
				"double"	double-line (default)
				"round"		rounded corners
				"ascii"		ASCII characters (-, |, +)
				"custom:X;X;X;X;X;X;X;X"
						eight characters separated by
						semicolons, in the order: top, right,
						bottom, left, topleft, topright,
						botright, botleft
				"on"		alias to "double"
				"off"		no border

To reflect that it still works as before this change.

@girishji
Copy link
Contributor Author

Looks good, although I would have added on as an alias to/of double to the doc:

		border		border style:
				"single"	thin box-drawing characters
				"double"	double-line (default)
				"round"		rounded corners
				"ascii"		ASCII characters (-, |, +)
				"custom:X;X;X;X;X;X;X;X"
						eight characters separated by
						semicolons, in the order: top, right,
						bottom, left, topleft, topright,
						botright, botleft
				"on"		alias to "double"
				"off"		no border

To reflect that it still works as before this change.

Wouldn’t it be better to deprecate the 'on' value to avoid redundancy?

@habamax
Copy link
Contributor

habamax commented Oct 13, 2025

Wouldn’t it be better to deprecate the 'on' value to avoid redundancy?

Probably. But it still needs to be mentioned as valid value (with deprecation note?), @chrisbra what do you think?

@girishji
Copy link
Contributor Author

"on"            deprecated, use "double"

@chrisbra
Copy link
Member

"on" deprecated, use "double"

Would that cause any backward incompatibilities?

@habamax
Copy link
Contributor

habamax commented Oct 14, 2025

"on" deprecated, use "double"

Would that cause any backward incompatibilities?

It works the same if you set completepopup+=border:on or set completepopup+=border:double. If in the future, border:on would be removed, it would be backward incompatible.

Marking it as deprecated sets expectation that in some future it might be removed (9.3? 9.4?), it would be up to core team to decide when to do it if ever.

M  runtime/doc/options.txt
M  src/optiondefs.h
M  src/optionstr.c
M  src/popupwin.c
M  src/proto/optionstr.pro
M  src/testdir/test_options.vim
@girishji
Copy link
Contributor Author

It works the same if you set completepopup+=border:on or set completepopup+=border:double. If in the future, border:on would be removed, it would be backward incompatible.

Marking it as deprecated sets expectation that in some future it might be removed (9.3? 9.4?), it would be up to core team to decide when to do it if ever.

That was my earlier approach to maintain backward compatibility. Now, however, I’ve made "on" a first-class value. It automatically switches between "double" and "ascii" when box characters aren’t available—matching the previous default behavior.

M  src/popupwin.c
M  src/popupwin.c
@chrisbra
Copy link
Member

alright, thanks

@chrisbra chrisbra closed this in 1a09f11 Oct 14, 2025
@girishji
Copy link
Contributor Author

Thanks

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.

3 participants