patch 9.1.1960: Wrong position of info popup

Commit: 
https://github.com/vim/vim/commit/7a0d0a022a09724f2c522f97a27ce8b1713f5978
Author: glepnir <[email protected]>
Date:   Sun Dec 7 18:54:26 2025 +0100

    patch 9.1.1960: Wrong position of info popup
    
    Problem:  When the popup menu is displayed above the cursor and the
              selected item has no room below for the info popup,
              popup_adjust_position() places the popup in the available
              space above. The calculation added some extra lines, causing
              the popup to be misaligned.
    Solution: For info popups, undo that extra spacing so the popup stays
              aligned with the selected item (glepnir)
    
    closes: #18860
    
    Signed-off-by: glepnir <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/popupwin.c b/src/popupwin.c
index 96f669a50..b74a9445b 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1647,6 +1647,8 @@ popup_adjust_position(win_T *wp)
            // make bottom aligned and recompute the height
            wp->w_height = w_height_before_limit;
            wp->w_winrow = wantline - 2 - wp->w_height - extra_height;
+           if (wp->w_popup_flags & POPF_INFO)
+               wp->w_winrow += extra_height + 2;
            if (wp->w_winrow < 0)
            {
                wp->w_height += wp->w_winrow;
diff --git a/src/testdir/dumps/Test_popupwin_infopopup_align_item_01.dump 
b/src/testdir/dumps/Test_popupwin_infopopup_align_item_01.dump
new file mode 100644
index 000000000..558a571ed
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_infopopup_align_item_01.dump
@@ -0,0 +1,15 @@
+| +0#af5f00255#ffffff0@1|1| | +0#0000000&@70
+| +0#af5f00255&@1|2| | +0#0000000&@70
+| +0#af5f00255&@1|3| | +0#0000000&@70
+| +0#af5f00255&@1|4| | +0#0000000&@70
+| +0#af5f00255&@1|5| | +0#0000000&@70
+| +0#af5f00255&@1|6| | +0#0000000&@70
+| +0#af5f00255&@1|7| | +0#0000000&@70
+| +0#af5f00255&@1|8| | +0#0000000&@14|╔+0#0000001#e0e0e08|═@7|X| 
+0#0000000#ffffff0@45
+| +0#af5f00255&@1|9| | +0#0000000&@14|║+0#0000001#e0e0e08| |N|i|n|e| @2|║| 
+0#0000000#ffffff0@45
+| +0#af5f00255&|1|0| +0#0000001#ffd7ff255|c|p|_|m|a|t|c|h|_|a|r@1|a|y| 
|║+0&#e0e0e08| |T|e|n| @3|║| +0#0000000#ffffff0@45
+| +0#af5f00255&|1@1| +0#0000001#ffd7ff255|c|p|_|s|t|r| @8|║+0&#e0e0e08| 
|E|l|e|v|e|n| |║| +0#0000000#ffffff0@45
+| +0#af5f00255&|1|2| +0#0000001#e0e0e08|c|p|_|s|c|o|r|e| @6|║| |T|w|e|l|v|e| 
|║| +0#0000000#ffffff0@45
+| +0#af5f00255&|1|3| |c+0#0000000&|p|_|s|c|o|r|e> 
@6|╚+0#0000001#e0e0e08|═@7|⇲| +0#0000000#ffffff0@45
+|~+0#4040ff13&| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| 
|m+0#00e0003&|a|t|c|h| |3| |o|f| |3| +0#0000000&@34
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 4b616a8a4..a608fbaf5 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -3783,6 +3783,38 @@ func Test_popupmenu_info_align_menu()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_popupmenu_info_align_item()
+  CheckScreendump
+  let lines =<< trim END
+    func Omni_test(findstart, base)
+        if a:findstart
+            return col(".")
+        endif
+        return [
+            \ #{word: "cp_match_array", info: "One
Two
Three
Four"},
+            \ #{word: "cp_str", info: "Five
Six
Seven
Eight"},
+            \ #{word: "cp_score", info: "Nine
Ten
Eleven
Twelve"},
+            \ ]
+    endfunc
+    set completepopup=border:on,align:item
+    set cot=menu,menuone,popup,
+    set omnifunc=Omni_test
+    set number
+  END
+  call writefile(lines, 'XtestInfoPopupPos', 'D')
+  let buf = RunVimInTerminal('-S XtestInfoPopupPos', #{rows: 15})
+  call TermWait(buf, 25)
+
+  call term_sendkeys(buf, "A"..repeat("\<CR>", 12))
+  call TermWait(buf, 25)
+  call term_sendkeys(buf, "\<C-X>\<C-O>\<C-N>\<C-N>")
+  call TermWait(buf, 25)
+  call VerifyScreenDump(buf, 'Test_popupwin_infopopup_align_item_01', {})
+
+  call term_sendkeys(buf, "\<Esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_popupmenu_info_hidden()
   CheckScreendump
   CheckFeature quickfix
diff --git a/src/version.c b/src/version.c
index f6133c52d..ba74665b5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1960,
 /**/
     1959,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vSJHj-003aUd-Fy%40256bit.org.

Raspunde prin e-mail lui