diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-12-10 06:50:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-10 06:50:03 +0800 |
commit | 7faf8a45e8c48d5ab1b6096d6b3e23c84bb3d7c6 (patch) | |
tree | 2b05e6e2b520a25ba8576fe5a8a5fbc83d3d59e0 /src | |
parent | 8b84a10db76ef2bd15bbd3c06ae2d5dfaadc1482 (diff) | |
download | rneovim-7faf8a45e8c48d5ab1b6096d6b3e23c84bb3d7c6.tar.gz rneovim-7faf8a45e8c48d5ab1b6096d6b3e23c84bb3d7c6.tar.bz2 rneovim-7faf8a45e8c48d5ab1b6096d6b3e23c84bb3d7c6.zip |
fix(events): skip WinScrolled for newly-created float windows (#21333)
Unlike split windows, creating a new floating window does not cause
other windows to resize, so it doesn't make much sense to trigger
WinScrolled or WinResized when creating a new floating window.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/window.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 75320bcb7d..05694a8b6d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5405,6 +5405,18 @@ static int check_window_scroll_resize(int *size_count, win_T **first_scroll_win, int tot_skipcol = 0; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { + // Skip floating windows that do not have a snapshot (usually becuase they are newly-created), + // as unlike split windows, creating floating windows do not 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; + wp->w_last_leftcol = wp->w_leftcol; + wp->w_last_skipcol = wp->w_skipcol; + wp->w_last_width = wp->w_width; + wp->w_last_height = wp->w_height; + continue; + } + const bool size_changed = wp->w_last_width != wp->w_width || wp->w_last_height != wp->w_height; if (size_changed) { |