aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-05 07:48:37 +0800
committerGitHub <noreply@github.com>2023-10-05 07:48:37 +0800
commit5f4f83ba322d2642d485669ecf762b629241d9dc (patch)
tree80e15591eddaf7b42efe08d437818e6e123394e5 /src
parentd7a240b1e99201fcd8ce17509f115d583b6e53a1 (diff)
downloadrneovim-5f4f83ba322d2642d485669ecf762b629241d9dc.tar.gz
rneovim-5f4f83ba322d2642d485669ecf762b629241d9dc.tar.bz2
rneovim-5f4f83ba322d2642d485669ecf762b629241d9dc.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/nvim/move.c10
1 files changed, 10 insertions, 0 deletions
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;