[vim/vim] completeopt+=popup might be too narrow (Issue #18606)

14 views
Skip to first unread message

Maxim Kim

unread,
Oct 19, 2025, 11:39:51 PM (2 days ago) Oct 19
to vim/vim, Subscribed
habamax created an issue (vim/vim#18606)

Steps to reproduce

I am yet to come up with the minimal repro steps, for now just documenting the issue:

image.png (view on web)

When completion item is too long, popup info window appears on the left being too narrow.

Expected behaviour

There is enough space to make it wide enough to present additional information.

Version of Vim

9.1.1868

Environment

debian13,bash

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606@github.com>

Maxim Kim

unread,
Oct 19, 2025, 11:40:36 PM (2 days ago) Oct 19
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

@girishji fyi, not sure if you did anything related.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3420428290@github.com>

Maxim Kim

unread,
Oct 20, 2025, 6:04:07 AM (yesterday) Oct 20
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

repro steps:

smallpopup.vim

vim9script

set complete=Fg:Popup
set completeopt=popup
set autocomplete

def g:Popup(findstart: number, base: string): any
    if findstart > 0
        var prefix = getline('.')->strpart(0, col('.') - 1)->matchstr('\S\+$')
        if prefix->empty()
            return -2
        endif
        return col('.') - prefix->len() - 1
    endif
    var items = [
        { word: 'apple aaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd eeeeeeeeeeeeeeee fffffffffffffffffffffffffffffff gggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjj', kind: 'F', info: 'A fruit' },
        { word: 'banana', kind: 'F', info: "Another fruit description with a bit of text.\nShould fit into popup window.\n" },
        { word: 'carrot', kind: 'V', info: 'A vegetable' },
        { word: 'date', kind: 'F', info: 'A sweet fruit' },
        { word: 'eggplant', kind: 'V', info: 'A purple vegetable' },
    ]
    return items->matchfuzzy(base, {key: "word"})
enddef
  1. vim --clean -S smallpopup.vim +"normal 20o"
  2. type i<tab><tab>b<C-n>

https://asciinema.org/a/gmnFm5WHhO37zatfRkPQKm8my

additionally if you don't provide enough space on the left, there would be no popup at all:

https://asciinema.org/a/NHRQ95h0IDDlfE0g0ANUJIYQ0


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3421363872@github.com>

girish

unread,
Oct 20, 2025, 7:14:50 AM (yesterday) Oct 20
to vim/vim, Subscribed
girishji left a comment (vim/vim#18606)

I didn’t make any fundamental changes to the positioning logic of the info window — only adjusted the dimensions to account for the border. You can take a look at pum_position_info_popup() in popupmenu.c to see if the positioning logic can be improved. I might not be able to dig into this myself for a few days until I get some time.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3421634868@github.com>

girish

unread,
Oct 20, 2025, 7:33:06 AM (yesterday) Oct 20
to vim/vim, Subscribed
girishji left a comment (vim/vim#18606)

In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3421691710@github.com>

Maxim Kim

unread,
Oct 20, 2025, 7:42:43 AM (yesterday) Oct 20
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.

Indeed, there is a space above that could be used for that. Not sure if in some cases it could be displayed below.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3421719410@github.com>

girish

unread,
Oct 20, 2025, 8:03:14 AM (24 hours ago) Oct 20
to vim/vim, Subscribed
girishji left a comment (vim/vim#18606)

In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.

Indeed, there is a space above that could be used for that. Not sure if in some cases it could be displayed below.

I don't know if other people will complain. We do not know the width needed for info window from popupmenu.c (rendering happens in popupwin.c). So you may end up with small info window above cursor. Can you check how other editors/IDEs handle this situation?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3421779336@github.com>

Maxim Kim

unread,
Oct 20, 2025, 8:21:58 PM (12 hours ago) Oct 20
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

Hm, I was thinking I remember it worked in emacs back in a day, resurrecting it, I am not able to even get the help preview for the candidates with corfu/company modes:

image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3424215748@github.com>

Maxim Kim

unread,
Oct 20, 2025, 8:33:34 PM (11 hours ago) Oct 20
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

I don't know if other people will complain. We do not know the width needed for info window from popupmenu.c (rendering happens in popupwin.c).

I didn't mean to change current layout algorithm completely, I was thinking about if resulting popup window couldn't be showed (not enough horizontal space) or too narrow, it could be repositioned either above or below completion candidates depending on available space.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3424236747@github.com>

Maxim Kim

unread,
Oct 20, 2025, 8:48:01 PM (11 hours ago) Oct 20
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

Or maybe preview could be allowed to overlap popup completion when there is not enough space with possibly an option?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3424258203@github.com>

girish

unread,
2:14 AM (6 hours ago) 2:14 AM
to vim/vim, Subscribed
girishji left a comment (vim/vim#18606)

There’s quite a lot of content in your info window. You could use 'preview' window instead of info popup. It might be worth improving the 'preview' window behavior — for example, automatically choosing whether to display the top or bottom half, or making it easier to dismiss (currently, Ctrl+C doesn’t close the preview window).

At the moment, the info popup works best when displaying a limited amount of information. Showing it above the cursor only really makes sense when there’s a large amount of content to display. However, since the position is decided before the contents are known — and some LSPs only send the info after an item is selected in the menu — this can lead to awkward positioning.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3424866664@github.com>

Maxim Kim

unread,
2:21 AM (6 hours ago) 2:21 AM
to vim/vim, Subscribed
habamax left a comment (vim/vim#18606)

I see, let’s close it then.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/18606/3424884712@github.com>

Maxim Kim

unread,
2:21 AM (6 hours ago) 2:21 AM
to vim/vim, Subscribed

Closed #18606 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/18606/issue_event/20395577465@github.com>

Reply all
Reply to author
Forward
0 new messages