]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1458: tabpanel: tabs not properly updated with 'stpl' v9.1.1458
authorHirohito Higashi <h.east.727@gmail.com>
Sun, 15 Jun 2025 14:09:22 +0000 (16:09 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 15 Jun 2025 14:09:22 +0000 (16:09 +0200)
Problem:  tabpanel: tabs not properly updated with 'stpl'
Solution: remember the Column offset per tabpage
          (Hirohito Higashi)

fixes: #17519
closes: #17544

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/structs.h
src/tabpanel.c
src/term.c
src/testdir/dumps/Test_tabpanel_stpl_eq_0_0.dump [new file with mode: 0644]
src/testdir/dumps/Test_tabpanel_stpl_eq_0_1.dump [new file with mode: 0644]
src/testdir/test_tabpanel.vim
src/version.c
src/window.c

index 55181eb42c7fb39f9cb61a9955f5914bcdff9c75..250dc2fbdde8bc2fc511b9fb5d881818ee4ff602 100644 (file)
@@ -3654,6 +3654,7 @@ struct tabpage_S
     long           tp_old_Rows;    // Rows when Tab page was left
     long           tp_old_Columns; // Columns when Tab page was left, -1 when
                                    // calling shell_new_columns() postponed
+    int                    tp_old_coloff;  // Column offset when Tab page was left
     long           tp_ch_used;     // value of 'cmdheight' when frame size
                                    // was set
 #ifdef FEAT_GUI
index 260768a3d5675198448826026e7bb3ef60acf1c9..d0f2d151a7fe84e8b3f09e85f3ec96098374fa41 100644 (file)
@@ -106,7 +106,6 @@ tabpanelopt_changed(void)
     tpl_is_vert = new_is_vert;
 
     shell_new_columns();
-    redraw_tabpanel = TRUE;
 
     if (do_equal)
        win_equal(curwin, FALSE, 0);
index 6f7983bfbf5cec8e152ba65f560799c66e3cdc39..c7ac8ab778523681371632aa4d227a620bf8156c 100644 (file)
@@ -3614,8 +3614,10 @@ win_new_shellsize(void)
 {
     static int old_Rows = 0;
     static int old_Columns = 0;
+    static int old_coloff = 0;
 
-    if (old_Rows != Rows || old_Columns != Columns)
+    if (old_Rows != Rows || old_Columns != COLUMNS_WITHOUT_TPL()
+           || old_coloff != TPL_LCOL(NULL))
        ui_new_shellsize();
     if (old_Rows != Rows)
     {
@@ -3627,20 +3629,12 @@ win_new_shellsize(void)
        old_Rows = Rows;
        shell_new_rows();       // update window sizes
     }
-    if (old_Columns != Columns)
+    if (old_Columns != COLUMNS_WITHOUT_TPL() || old_coloff != TPL_LCOL(NULL))
     {
-       old_Columns = Columns;
+       old_Columns = COLUMNS_WITHOUT_TPL();
+       old_coloff = TPL_LCOL(NULL);
 
-       tabpage_T *save_curtab = curtab;
-       tabpage_T *tp;
-       FOR_ALL_TABPAGES(tp)
-       {
-           unuse_tabpage(curtab);
-           use_tabpage(tp);
-           shell_new_columns();
-       }
-       unuse_tabpage(curtab);
-       use_tabpage(save_curtab);
+       shell_new_columns();
     }
 }
 
diff --git a/src/testdir/dumps/Test_tabpanel_stpl_eq_0_0.dump b/src/testdir/dumps/Test_tabpanel_stpl_eq_0_0.dump
new file mode 100644 (file)
index 0000000..8a25711
--- /dev/null
@@ -0,0 +1,10 @@
+| +8#0000001#e0e0e08|+| |[|N|o| |N|a|m|e|]| | +2#0000000#ffffff0|0@3| | +1&&@57|X+8#0000001#e0e0e08
+> +0#0000000#ffffff0@77
+|~+0#4040ff13&| @76
+|~| @76
+|~| @76
+|~| @76
+|~| @76
+|~| @76
+|~| @76
+| +0#0000000&@77
diff --git a/src/testdir/dumps/Test_tabpanel_stpl_eq_0_1.dump b/src/testdir/dumps/Test_tabpanel_stpl_eq_0_1.dump
new file mode 100644 (file)
index 0000000..2ed5307
--- /dev/null
@@ -0,0 +1,10 @@
+| +2&#ffffff0|+| |[|N|o| |N|a|m|e|]| | +8#0000001#e0e0e08|0@3| | +1#0000000#ffffff0@57|X+8#0000001#e0e0e08
+>a+0#0000000#ffffff0@2| @74
+|b@2| @74
+|c@2| @74
+|d@2| @74
+|~+0#4040ff13&| @76
+|~| @76
+|~| @76
+|~| @76
+| +0#0000000&@77
index 959734fcad9ab517d8d932e61b7f5e8a151070b5..0d79650834cfb8c3550fdd8d14109c64357aa075 100644 (file)
@@ -10,6 +10,25 @@ function s:reset()
   set showtabpanel&
 endfunc
 
+function Test_tabpanel_showtabpanel_eq_0()
+  CheckScreendump
+
+  let lines =<< trim END
+    set showtabpanel=2
+    set noruler
+    call setbufline(bufnr(), 1, ['aaa','bbb','ccc','ddd'])
+    tabnew 0000
+  END
+  call writefile(lines, 'XTest_tabpanel_stpl_eq_0', 'D')
+
+  let buf = RunVimInTerminal('-S XTest_tabpanel_stpl_eq_0', {'rows': 10, 'cols': 78})
+  call term_sendkeys(buf, ":set showtabpanel=0\<CR>\<C-L>")
+  call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_0_0', {})
+  call term_sendkeys(buf, ":tabnext\<CR>\<C-L>")
+  call VerifyScreenDump(buf, 'Test_tabpanel_stpl_eq_0_1', {})
+  call StopVimInTerminal(buf)
+endfunc
+
 function Test_tabpanel_showtabpanel_eq_1()
   CheckScreendump
 
index a9e73850fb396df1a999a699bac61ab455177719..570a0886c407601466128af07c688441cc77b667 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1458,
 /**/
     1457,
 /**/
index f3b23e85a378d5152d077a1f4cbf1415edfdb26b..52f4b1a8bdf556ee0f6d8085ee5b4aec0d028b7e 100644 (file)
@@ -3463,9 +3463,6 @@ win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
        redraw_tabline = TRUE;
        if (h != tabline_height())
            shell_new_rows();
-#if defined(FEAT_TABPANEL)
-       redraw_tabpanel = TRUE;
-#endif
        shell_new_columns();
     }
 
@@ -4767,19 +4764,7 @@ win_new_tabpage(int after)
 #endif
 #if defined(FEAT_TABPANEL)
        if (prev_columns != COLUMNS_WITHOUT_TPL())
-       {
-           tabpage_T *save_curtab = curtab;
-
-           unuse_tabpage(curtab);
-           use_tabpage(prev_tp);
-           shell_new_rows();
            shell_new_columns();
-
-           unuse_tabpage(curtab);
-           use_tabpage(save_curtab);
-           shell_new_rows();
-           shell_new_columns();
-       }
 #endif
        redraw_all_later(UPD_NOT_VALID);
        apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
@@ -4988,7 +4973,10 @@ leave_tabpage(
     tp->tp_lastwin = lastwin;
     tp->tp_old_Rows = Rows;
     if (tp->tp_old_Columns != -1)
+    {
        tp->tp_old_Columns = topframe->fr_width;
+       tp->tp_old_coloff = firstwin->w_wincol;
+    }
     firstwin = NULL;
     lastwin = NULL;
     return OK;
@@ -5051,12 +5039,14 @@ enter_tabpage(
 #endif
                ))
        shell_new_rows();
-    if (curtab->tp_old_Columns != topframe->fr_width)
+    if (curtab->tp_old_Columns != COLUMNS_WITHOUT_TPL()
+           || curtab->tp_old_coloff != TPL_LCOL(NULL))
     {
        if (starting == 0)
        {
            shell_new_columns();        // update window widths
            curtab->tp_old_Columns = topframe->fr_width;
+           curtab->tp_old_coloff = firstwin->w_wincol;
        }
        else
            curtab->tp_old_Columns = -1;  // update window widths later