patch 9.1.1696: tabnr from getwininfo() for popup windows is always 0

Commit: 
https://github.com/vim/vim/commit/7d6be2cead4e58356387b52ab9587c079a167775
Author: Sean Dewar <[email protected]>
Date:   Tue Aug 26 21:45:07 2025 +0200

    patch 9.1.1696: tabnr from getwininfo() for popup windows is always 0
    
    Problem:  getwininfo() has logic for getting the tabnr of a local popup
              window, but due to only breaking from the inner loop, tp is
              eventually set to NULL, so tabnr is always 0.
    Solution: Break out of both loops, continue to use 0 for global popup
              windows (Sean Dewar).
    
    closes: #18111
    
    Signed-off-by: Sean Dewar <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/evalwindow.c b/src/evalwindow.c
index 613df0f25..9e90dffc7 100644
--- a/src/evalwindow.c
+++ b/src/evalwindow.c
@@ -563,9 +563,10 @@ f_getwininfo(typval_T *argvars, typval_T *rettv)
        {
            tabnr++;
            FOR_ALL_POPUPWINS_IN_TAB(tp, wp)
-           if (wp == wparg)
-               break;
+               if (wp == wparg)
+                   goto found;
        }
+found:
        d = get_win_info(wparg, tp == NULL ? 0 : tabnr, 0);
        if (d != NULL)
            list_append_dict(rettv->vval.v_list, d);
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 0ee6e8910..955cc2c9d 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -4619,4 +4619,19 @@ func Test_popupwin_bottom_position_without_decoration()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_popup_getwininfo_tabnr()
+  tab split
+  let winid1 = popup_create('sup', #{tabpage: 1})
+  let winid2 = popup_create('sup', {})
+  let winid3 = popup_create('sup', #{tabpage: -1})
+  call assert_equal(1, getwininfo(winid1)[0].tabnr)
+  call assert_equal(2, getwininfo(winid2)[0].tabnr)
+  call assert_equal(0, getwininfo(winid3)[0].tabnr)
+
+  call popup_close(winid1)
+  call popup_close(winid2)
+  call popup_close(winid3)
+  tabonly
+endfunc
+
 " vim: shiftwidth=2 sts=2
diff --git a/src/version.c b/src/version.c
index 0a90f015c..1509b9728 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1696,
 /**/
     1695,
 /**/

-- 
-- 
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/E1uqzpt-003sQ4-Ms%40256bit.org.

Raspunde prin e-mail lui