From f1b88ced07a5dcc62cd847cade2ed97e23fffbf9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 23 Nov 2022 12:14:16 +0800 Subject: fix(options): fix local 'sidescrolloff' doesn't work for mouse (#21162) Missing part of Vim patch 8.1.0864. --- src/nvim/cursor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/nvim/cursor.c') diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 84a2cf83ac..0d56319891 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -456,12 +456,13 @@ bool leftcol_changed(void) // If the cursor is right or left of the screen, move it to last or first // character. - if (curwin->w_virtcol > (colnr_T)(lastcol - p_siso)) { + long siso = get_sidescrolloff_value(curwin); + if (curwin->w_virtcol > (colnr_T)(lastcol - siso)) { retval = true; - coladvance((colnr_T)(lastcol - p_siso)); - } else if (curwin->w_virtcol < curwin->w_leftcol + p_siso) { + coladvance((colnr_T)(lastcol - siso)); + } else if (curwin->w_virtcol < curwin->w_leftcol + siso) { retval = true; - coladvance((colnr_T)(curwin->w_leftcol + p_siso)); + coladvance((colnr_T)(curwin->w_leftcol + siso)); } // If the start of the character under the cursor is not on the screen, -- cgit