From 5f4f83ba322d2642d485669ecf762b629241d9dc Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 5 Oct 2023 07:48:37 +0800 Subject: vim-patch:9.0.1983: scrolling inactive window not possible with cursorbind (#25507) Problem: Scrolling non-current window using mouse is inconsistent depending on 'scrollbind'/'scrolloff' and different from GUI vertical scrollbar when 'cursorbind' is set. Solution: Don't move cursor in non-current windows for 'cursorbind' if cursor in the current window didn't move. closes: vim/vim#13219 closes: vim/vim#13210 https://github.com/vim/vim/commit/8e5f26ec6a1446aabffa7a0a7819a7462372a5b8 --- src/nvim/move.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/nvim/move.c b/src/nvim/move.c index 9e0aa43138..55cd90c5ae 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -32,6 +32,7 @@ #include "nvim/grid.h" #include "nvim/highlight.h" #include "nvim/macros.h" +#include "nvim/mark.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/message.h" @@ -2684,6 +2685,15 @@ void halfpage(bool flag, linenr_T Prenum) void do_check_cursorbind(void) { + static win_T *prev_curwin = NULL; + static pos_T prev_cursor = { 0, 0, 0 }; + + if (curwin == prev_curwin && equalpos(curwin->w_cursor, prev_cursor)) { + return; + } + prev_curwin = curwin; + prev_cursor = curwin->w_cursor; + linenr_T line = curwin->w_cursor.lnum; colnr_T col = curwin->w_cursor.col; colnr_T coladd = curwin->w_cursor.coladd; -- cgit