neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit bf9e92c81c3cec65be5359d6b6a2ba1177995279
parent 7367838359bfb5fadf72ea2aeea2f84efb34590e
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sat, 27 Jan 2024 15:18:41 +0800

fix(events): check for WinResized/WinScrolled in terminal mode (#27226)


Diffstat:
Msrc/nvim/terminal.c | 3+++
Msrc/nvim/window.c | 2+-
Mtest/functional/autocmd/win_scrolled_resized_spec.lua | 17+++++++++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c @@ -93,6 +93,7 @@ #include "nvim/types_defs.h" #include "nvim/ui.h" #include "nvim/vim_defs.h" +#include "nvim/window.h" typedef struct { VimState state; @@ -615,6 +616,8 @@ static int terminal_check(VimState *state) curbuf->b_locked--; } + may_trigger_win_scrolled_resized(); + if (need_maketitle) { // Update title in terminal-mode. #7248 maketitle(); } diff --git a/src/nvim/window.c b/src/nvim/window.c @@ -5367,7 +5367,7 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win, FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { // Skip floating windows that do not have a snapshot (usually because they are newly-created), - // as unlike split windows, creating floating windows do not cause other windows to resize. + // as unlike split windows, creating floating windows doesn't cause other windows to resize. if (wp->w_floating && wp->w_last_topline == 0) { wp->w_last_topline = wp->w_topline; wp->w_last_topfill = wp->w_topfill; diff --git a/test/functional/autocmd/win_scrolled_resized_spec.lua b/test/functional/autocmd/win_scrolled_resized_spec.lua @@ -39,6 +39,23 @@ describe('WinResized', function() eq(2, eval('g:resized')) eq({ windows = { 1002, 1001, 1000 } }, eval('g:v_event')) end) + + it('is triggered in terminal mode #21197 #27207', function() + exec([[ + autocmd TermOpen * startinsert + let g:resized = 0 + autocmd WinResized * let g:resized += 1 + ]]) + eq(0, eval('g:resized')) + + command('vsplit term://') + eq({ mode = 't', blocking = false }, api.nvim_get_mode()) + eq(1, eval('g:resized')) + + command('split') + eq({ mode = 't', blocking = false }, api.nvim_get_mode()) + eq(2, eval('g:resized')) + end) end) describe('WinScrolled', function()