diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-30 15:59:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-30 15:59:11 +0800 |
commit | cb9d68fe6daf214ba703b9c2376fc8a2b8ae7079 (patch) | |
tree | 6f39ab5d25d1c9ef92bd5a33d8f316ae1673c93e | |
parent | 4703e561d5bc0eef13da171c4f8f8b6e02ae4883 (diff) | |
parent | d7855caa183f9eacc7cfd3f2ab7f071063ff84af (diff) | |
download | rneovim-cb9d68fe6daf214ba703b9c2376fc8a2b8ae7079.tar.gz rneovim-cb9d68fe6daf214ba703b9c2376fc8a2b8ae7079.tar.bz2 rneovim-cb9d68fe6daf214ba703b9c2376fc8a2b8ae7079.zip |
Merge pull request #21591 from zeertzjq/vim-8.2.3773
vim-patch:8.2.{3773,3774}
-rw-r--r-- | contrib/luarc.json | 1 | ||||
-rw-r--r-- | src/nvim/buffer_defs.h | 3 | ||||
-rw-r--r-- | src/nvim/window.c | 13 | ||||
-rw-r--r-- | test/functional/core/startup_spec.lua | 13 |
4 files changed, 26 insertions, 4 deletions
diff --git a/contrib/luarc.json b/contrib/luarc.json index 68d1d5800a..ebad0581b9 100644 --- a/contrib/luarc.json +++ b/contrib/luarc.json @@ -11,6 +11,7 @@ "after_each", "setup", "teardown", + "finally", "lfs" ] }, 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; diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 7664401824..9e22efa545 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -465,6 +465,19 @@ describe('startup', function() clear{args={'--cmd', 'set packpath^=test/functional/fixtures', '--cmd', [[ lua _G.test_loadorder = {} vim.cmd "runtime! filen.lua" ]]}, env={XDG_CONFIG_HOME='test/functional/fixtures/'}} eq({'ordinary', 'FANCY', 'FANCY after', 'ordinary after'}, exec_lua [[ return _G.test_loadorder ]]) end) + + it('window widths are correct when modelines set &columns with tabpages', function() + write_file('tab1.noft', 'vim: columns=81') + write_file('tab2.noft', 'vim: columns=81') + finally(function() + os.remove('tab1.noft') + os.remove('tab2.noft') + end) + clear({args = {'-p', 'tab1.noft', 'tab2.noft'}}) + eq(81, meths.win_get_width(0)) + command('tabnext') + eq(81, meths.win_get_width(0)) + end) end) describe('sysinit', function() |