[vim/vim] Rewrite popup menu positioning logic and fix bugs (PR #18441)

8 views
Skip to first unread message

girish

unread,
Sep 29, 2025, 2:53:06 PM (yesterday) Sep 29
to vim/vim, Subscribed

Refactor

  • Simplified and rewrote horizontal positioning logic (was overly complex).
  • Split horizontal and vertical positioning into separate functions.

Bug fixes

  • Fixed missing truncation marker (e.g. >) when items were truncated and pummaxwidth was not set.
  • Fixed occasional extra space being added to menu items.

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18441

Commit Summary

  • 3e13bcb Fix & Refactor: Popupmenu positioning
  • b6ff7e1 Fix test failures
  • 07e7dae refactor
  • 43b7edf Merge branch 'vim:master' into refactor
  • 8a388d0 Merge branch 'vim:master' into refactor

File Changes

(22 files)

Patch Links:


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

zeertzjq

unread,
Sep 29, 2025, 8:51:02 PM (19 hours ago) Sep 29
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/popupmenu.c:

> +    {
+	width = p_pw;
+	end_padding = FALSE;
+    }
+    if (p_pmw > 0 && width > p_pmw)
+    {
+	width = p_pmw;
+	end_padding = FALSE;
+    }
+
+    pum_width = width + (end_padding && width >= p_pw ? 1 : 0);
+    return available_width >= pum_width;
+}
+
+/*
+ * Calculate horizontal placement for popup menu for insert-mode completion.

This is called for cmdline completion as well.


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/pull/18441/review/3282253037@github.com>

girish

unread,
Sep 29, 2025, 10:04:43 PM (18 hours ago) Sep 29
to vim/vim, Push

@girishji pushed 1 commit.

  • d656595 Improve comment and fix test failure


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18441/before/6599570cd810188ac0962c6e16e7b09a0a6da740/after/d656595be154a67660267c91ca2af72e2d9f9026@github.com>

girish

unread,
Sep 29, 2025, 10:52:06 PM (17 hours ago) Sep 29
to vim/vim, Push

@girishji pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18441/before/d656595be154a67660267c91ca2af72e2d9f9026/after/1cbcb015f7601b0980a1947ccbd7053d994a3027@github.com>

girish

unread,
4:12 AM (11 hours ago) 4:12 AM
to vim/vim, Subscribed
girishji left a comment (vim/vim#18441)

Test_popupwin_infopopup_6.dump and Test_popupwin_infopopup_7.dump are already incorrect:
they show the info window but not the popup menu.

This issue occurs only in the test; I cannot reproduce it otherwise.
In Test_popupmenu_info_border(), setting of pumheight=3 causes the problem.
Without pumheight, the popup menu displays correctly, but pumheight is needed for the test.

If anyone has suggestions, please let me know.
Otherwise I’ll work around it by adding :set completepopup=border:off, which avoids the issue.


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/pull/18441/c3350560683@github.com>

girish

unread,
4:23 AM (11 hours ago) 4:23 AM
to vim/vim, Push

@girishji pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18441/before/1cbcb015f7601b0980a1947ccbd7053d994a3027/after/36df7d0ab8a950b8dcd96c9d44f54a97f4905af4@github.com>

Reply all
Reply to author
Forward
0 new messages