How about the popup menu info popup?

129 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 20, 2019, 11:18:26 AM8/20/19
to vim...@googlegroups.com

Last weekend I added the "popup" value to 'completeopt' and added the
'completepopup' option. This makes it possible to show extra info for
an item in the complete menu in a popup window. It should work much
better than using the preview window for this.

Using it requires a kind of completion that adds the "info" field to
complete entries.

Please try it out and let us know what you like or dislike about it.

--
From "know your smileys":
*<|:-) Santa Claus (Ho Ho Ho)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Paul Jolly

unread,
Aug 20, 2019, 11:36:01 AM8/20/19
to Vim Dev Mailing List
> Please try it out and let us know what you like or dislike about it.

My immediate feedback from a govim perspective: it's great, thank you to everyone involved.

I can't, however, find a way to position the extra info popup relative to the top right (or wherever there is most space) of the completion menu.

By way of example, here are the original screen shots from https://github.com/vim/vim/issues/4544#issue-456551978:

59383470-f5e54980-8d2d-11e9-8921-9f4f3f97e09a.png

In my head, the extra info popup to the right is nicely spaced one character-width to the right of the completion menu, aligned with the top of it. Regardless of which item is selected in the completion candidates.

Contrast what I currently have (ignore the bad highlighting):

Screen Shot 2019-08-20 at 16.29.24.png

Am I missing something obvious here?

Thanks

Bram Moolenaar

unread,
Aug 20, 2019, 2:23:54 PM8/20/19
to vim...@googlegroups.com, Paul Jolly

Paul Jolly wrote:

> > Please try it out and let us know what you like or dislike about it.
>
> My immediate feedback from a govim perspective: it's great, thank you to
> everyone involved.
>
> I can't, however, find a way to position the extra info popup relative to
> the top right (or wherever there is most space) of the completion menu.

That's the kind of feedback I was hoping for.

> By way of example, here are the original screen shots from
> https://github.com/vim/vim/issues/4544#issue-456551978:
>
> [image: 59383470-f5e54980-8d2d-11e9-8921-9f4f3f97e09a.png]
>
> In my head, the extra info popup to the right is nicely spaced one
> character-width to the right of the completion menu, aligned with the top
> of it. Regardless of which item is selected in the completion candidates.
>
> Contrast what I currently have (ignore the bad highlighting):
>
> [image: Screen Shot 2019-08-20 at 16.29.24.png]
>
> Am I missing something obvious here?

The current way is to align the info popup with the selected entry.
We could add an option to align it with the popup menu as a whole.
I assume that when the menu is below the text, the popup would align
with the top of the menu, and when the menu is above the text the popup
aligns with the bottom of the text. Thus the popup is close to where
the user is typing. Sound OK?

--
From "know your smileys":
...---... SOS

Ben Jackson

unread,
Aug 20, 2019, 3:29:25 PM8/20/19
to vim_dev
Thanks Bram. I like it a lot.

One thing i would like is the ability to remove the borders. I’m not a fan of the borders in general due to the extra screen space they use (and this the extra code they cover). I can also live without the X in the corner if the popup goes away with Ctrl-y which I think it does.

I did notice a draw bug when testing. I can raise an issue if you like, but I was just testing the right side of the screen.

Create a vsplit and get it so the pum is towards right of screen and the info popup draws to the left, but overlaps the window to the left too. When changing the pum selection, artefacts are left in the non active window. Example:

https://files.gitter.im/Valloric/ycmd/DT1n/Screenshot-2019-08-19-at-22.32.31.png

Bram Moolenaar

unread,
Aug 20, 2019, 3:53:34 PM8/20/19
to vim...@googlegroups.com, Ben Jackson

Ben Jackson wrote:

> Thanks Bram. I like it a lot.
>
> One thing i would like is the ability to remove the borders. I’m not a
> fan of the borders in general due to the extra screen space they use
> (and this the extra code they cover). I can also live without the X in
> the corner if the popup goes away with Ctrl-y which I think it does.

We could support the full array, like the "border" argument of
popup_create(). But I suppose for this info popup just on/off will be
sufficient. And the "border" argument actually doesn't have a value for
"off", you would need to use [0,0,0,0]. Thus perhaps it's better to
have a "border" argument that can be "on" or "off".

> I did notice a draw bug when testing. I can raise an issue if you
> like, but I was just testing the right side of the screen.
>
> Create a vsplit and get it so the pum is towards right of screen and
> the info popup draws to the left, but overlaps the window to the left
> too. When changing the pum selection, artefacts are left in the non
> active window. Example:
>
> https://files.gitter.im/Valloric/ycmd/DT1n/Screenshot-2019-08-19-at-22.32.31.png

I did notice something like this when debugging, but could not reproduce
it. Perhaps it happens when the info popup is on a window that won't be
redrawn. When the popup menu is visible some redrawing is skipped to
avoid flicker, that probably interferes here.

--
From "know your smileys":
(X0||) Double hamburger with lettuce and tomato

Paul Jolly

unread,
Aug 20, 2019, 4:10:59 PM8/20/19
to Vim Dev Mailing List, Ben Jackson
> One thing i would like is the ability to remove the borders. I’m not a
> fan of the borders in general due to the extra screen space they use
> (and this the extra code they cover). I can also live without the X in
> the corner if the popup goes away with Ctrl-y which I think it does.

We could support the full array, like the "border" argument of
popup_create().  But I suppose for this info popup just on/off will be
sufficient.  And the "border" argument actually doesn't have a value for
"off", you would need to use [0,0,0,0].  Thus perhaps it's better to
have a "border" argument that can be "on" or "off".

Could we perhaps allow for a dictionary of options to be specified? 

The line and col values could then be used as relative values, which would allow for fine tuning of the approach you described in your earlier response to me. 

Thinking about it, pos might not have any meaning given it's value will in effect be calculated. 

> Thus the popup is close to where the user is typing.  Sound OK?

I think so, yes. 

Bram Moolenaar

unread,
Aug 20, 2019, 5:14:53 PM8/20/19
to vim...@googlegroups.com, Paul Jolly, Ben Jackson

Paul Jolly wrote:

> > > One thing i would like is the ability to remove the borders. I’m not a
> > > fan of the borders in general due to the extra screen space they use
> > > (and this the extra code they cover). I can also live without the X in
> > > the corner if the popup goes away with Ctrl-y which I think it does.
> >
> > We could support the full array, like the "border" argument of
> > popup_create(). But I suppose for this info popup just on/off will be
> > sufficient. And the "border" argument actually doesn't have a value for
> > "off", you would need to use [0,0,0,0]. Thus perhaps it's better to
> > have a "border" argument that can be "on" or "off".
>
> Could we perhaps allow for a dictionary of options to be specified?

Options only support a string.

> The line and col values could then be used as relative values, which would
> allow for fine tuning of the approach you described in your earlier
> response to me.
>
> Thinking about it, pos might not have any meaning given it's value will in
> effect be calculated.
>
> > Thus the popup is close to where the user is typing. Sound OK?
>
> I think so, yes.

We can add a popup_getinfo() function, so you can set all the
properties. But this may have to be done every time the selection
changes. It might work with the already existing CompleteChanged
autocommand event. But it's not triggered when only the selected item
changes.

--
From "know your smileys":
8<}} Glasses, big nose, beard

Nick Jensen

unread,
Aug 20, 2019, 6:59:48 PM8/20/19
to vim...@googlegroups.com
The 2019-08-20 23:14, Bram Moolenaar wrote:
> We can add a popup_getinfo() function, so you can set all the
> properties. But this may have to be done every time the selection
> changes. It might work with the already existing CompleteChanged
> autocommand event. But it's not triggered when only the selected item
> changes.

Could this function then also be used for setting text-property highlights? I
see that it is included in the todo list as a question:

> - Use a popup window for the "info" item of completion instead of using a
> preview window. Ideas in issue #4544.
> How to add highlighting?

Answer: I don't know :D But I'm looking forward to using it! Using `set
completeopt+=popup` is already much nicer than using the preview window.

Bram Moolenaar

unread,
Aug 21, 2019, 6:55:19 AM8/21/19
to vim...@googlegroups.com, Nick Jensen
The highlighting is already working.

Thinking about this again, it's probably best to add popup_getinfo() and
when the info popup is removed, to hide it instead of deleting it.
That way the properties you set on it will be kept.

--
From "know your smileys":
2B|^2B Message from Shakespeare

Bram Moolenaar

unread,
Aug 21, 2019, 2:26:34 PM8/21/19
to vim...@googlegroups.com, Ben Jackson
I cannot reproduce this problem now. Perhaps it's fixed as a side
effect of other changes? If you can still reproduce it with the latest
version, please send a script with reproduction steps.

--
From "know your smileys":
[:-) Frankenstein's monster

Ben Jackson

unread,
Aug 24, 2019, 6:56:27 AM8/24/19
to Bram Moolenaar, vim...@googlegroups.com
I can still repro as of latest patch just now, so I will try and write a minimal case.

Ben Jackson

unread,
Aug 24, 2019, 7:28:04 AM8/24/19
to Bram Moolenaar, vim...@googlegroups.com
Raised; https://github.com/vim/vim/issues/4860

> On 21 Aug 2019, at 19:26, Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>

Paul Jolly

unread,
Sep 4, 2019, 1:33:54 PM9/4/19
to Vim Dev Mailing List, Nick Jensen
Hi Bram,

> Thinking about this again, it's probably best to add popup_getinfo() and
> when the info popup is removed, to hide it instead of deleting it.
> That way the properties you set on it will be kept.

Sorry, I lost track of where we got to with this conversation.

Is there now a means by which I can position the extra info popup
relative to the top right (or wherever there is most space) of the
completion menu?

Thanks,


Paul

Bram Moolenaar

unread,
Sep 4, 2019, 2:09:56 PM9/4/19
to vim...@googlegroups.com, Paul Jolly, Nick Jensen
Use popup_findinfo() to find the popup info window.
See ":help complete-popup" for the size and align options.

--
hundred-and-one symptoms of being an internet addict:
185. You order fast food over the Internet

Paul Jolly

unread,
Sep 5, 2019, 5:20:47 AM9/5/19
to Bram Moolenaar, Vim Dev Mailing List, Nick Jensen
Hi Bram,

> Use popup_findinfo() to find the popup info window.
> See ":help complete-popup" for the size and align options.

Ah, thanks very much. Actually the option I think we'll go for for now
is some variation of:

set completepopup=align:menu,border:off

Thanks,


Paul
Reply all
Reply to author
Forward
0 new messages