From 83472b3808c3cda869471442793ece9e7a0ce261 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 30 Dec 2022 14:41:59 +0800 Subject: [PATCH] vim-patch:8.2.{3773,3774} vim-patch:8.2.3773: wrong window size when a modeline changes 'columns' Problem: Wrong window size when a modeline changes 'columns' and there is more than one tabpage. (Michael Soyka) Solution: Adjust the frames of all tabpages. (closes vim/vim#9315) https://github.com/vim/vim/commit/8a7374f8c4eb4c016270ad908a43af4ddedcbf56 vim-patch:8.2.3774: test for command line height fails Problem: Test for command line height fails. Solution: Use another way to handle window size change. https://github.com/vim/vim/commit/b711814cb64b60ec4918e3e1fb2ca5c50d6e9340 Co-authored-by: Bram Moolenaar --- src/nvim/buffer_defs.h | 3 ++- src/nvim/window.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 90fdaf9d3b..df4ebdffc0 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -903,7 +903,8 @@ struct tabpage_S { win_T *tp_firstwin; ///< first window in this Tab page win_T *tp_lastwin; ///< last window in this Tab page long tp_old_Rows_avail; ///< ROWS_AVAIL when Tab page was left - long tp_old_Columns; ///< Columns when Tab page was left + long tp_old_Columns; ///< Columns when Tab page was left, -1 when + ///< calling win_new_screen_cols() postponed long tp_ch_used; ///< value of 'cmdheight' when frame size was set diff_T *tp_first_diff; diff --git a/src/nvim/window.c b/src/nvim/window.c index fe771c52c6..4c03893173 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4277,7 +4277,9 @@ static int leave_tabpage(buf_T *new_curbuf, bool trigger_leave_autocmds) tp->tp_firstwin = firstwin; tp->tp_lastwin = lastwin; tp->tp_old_Rows_avail = ROWS_AVAIL; - tp->tp_old_Columns = Columns; + if (tp->tp_old_Columns != -1) { + tp->tp_old_Columns = Columns; + } firstwin = NULL; lastwin = NULL; return OK; @@ -4340,8 +4342,13 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, bool trigger_enter_a if (curtab->tp_old_Rows_avail != ROWS_AVAIL || (old_off != firstwin->w_winrow)) { win_new_screen_rows(); } - if (curtab->tp_old_Columns != Columns && starting == 0) { - win_new_screen_cols(); // update window widths + if (curtab->tp_old_Columns != Columns) { + if (starting == 0) { + win_new_screen_cols(); // update window widths + curtab->tp_old_Columns = Columns; + } else { + curtab->tp_old_Columns = -1; // update window widths later + } } lastused_tabpage = old_curtab;