patch 9.2.0197: tabpanel: frame width not updated for existing tab pages

Commit: 
https://github.com/vim/vim/commit/a4cf8124628342ef4dd09db894823ff907542695
Author: Hirohito Higashi <[email protected]>
Date:   Wed Mar 18 21:16:14 2026 +0000

    patch 9.2.0197: tabpanel: frame width not updated for existing tab pages
    
    Problem:  When 'showtabpanel' is set before any window exists (e.g. via
              --cmd) and multiple tab pages are opened with -p, the tabpanel
              appears when the second tab page is created.  At that point
              shell_new_columns() only updates the current (new) tab page's
              frame width; existing tab pages retain the wrong width.
    Solution: After calling shell_new_columns() in win_new_tabpage(), iterate
              all other tab pages and update their frame widths with
              frame_new_width() (Hirohito Higashi).
    
    related: #19730
    closes:  #19734
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
    Signed-off-by: Hirohito Higashi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/testdir/test_tabpanel.vim b/src/testdir/test_tabpanel.vim
index 6e401c0fd..556cc3b83 100644
--- a/src/testdir/test_tabpanel.vim
+++ b/src/testdir/test_tabpanel.vim
@@ -849,4 +849,27 @@ function Test_tabpanel_with_cmdline_no_pum()
   call StopVimInTerminal(buf)
 endfunc
 
+" When showtabpanel=1 and a second tab is opened, all existing tab pages must
+" have their frame width updated, not just the newly created one.
+function Test_tabpanel_showtabpanel_via_cmd_arg()
+  let tpl_width = 20  " default tpl_columns
+  set showtabpanel=1 noruler
+
+  " With one tab the tabpanel is hidden; no width reduction yet.
+  tabfirst
+  call assert_equal(&columns, winwidth(0))
+
+  " Opening a second tab makes the tabpanel visible; the first tab page must
+  " also get its frame width reduced.
+  tabnew
+  tabfirst
+  call assert_equal(&columns - tpl_width, winwidth(0),
+        \ 'first tab width after tabnew')
+  call assert_equal(tpl_width + 1, win_screenpos(0)[1],
+        \ 'first tab wincol after tabnew')
+
+  tabonly
+  set showtabpanel& noruler&
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 73c466b41..9d5bbf02d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    197,
 /**/
     196,
 /**/
diff --git a/src/window.c b/src/window.c
index 390c084fa..b0f4574b3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4884,7 +4884,21 @@ win_new_tabpage(int after)
 #endif
 #if defined(FEAT_TABPANEL)
        if (prev_columns != COLUMNS_WITHOUT_TPL())
+       {
+           tabpage_T   *tp2;
+           int         w = COLUMNS_WITHOUT_TPL();
+
            shell_new_columns();
+           // shell_new_columns() only updates the current tab page; fix up
+           // all others.
+           FOR_ALL_TABPAGES(tp2)
+               if (tp2 != curtab)
+               {
+                   frame_new_width(tp2->tp_topframe, w, FALSE, TRUE);
+                   if (!frame_check_width(tp2->tp_topframe, w))
+                       frame_new_width(tp2->tp_topframe, w, FALSE, FALSE);
+               }
+       }
 #endif
        redraw_all_later(UPD_NOT_VALID);
        apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);

-- 
-- 
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/E1w2ySp-00C7D0-Nk%40256bit.org.

Raspunde prin e-mail lui