aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-23 12:14:16 +0800
committerGitHub <noreply@github.com>2022-11-23 12:14:16 +0800
commitf1b88ced07a5dcc62cd847cade2ed97e23fffbf9 (patch)
treea0f39df580c605910ef542d5e7cd3ce651f2742e /src
parent4571ba4d0a5234408e544c3a98f107688a792f0d (diff)
downloadrneovim-f1b88ced07a5dcc62cd847cade2ed97e23fffbf9.tar.gz
rneovim-f1b88ced07a5dcc62cd847cade2ed97e23fffbf9.tar.bz2
rneovim-f1b88ced07a5dcc62cd847cade2ed97e23fffbf9.zip
fix(options): fix local 'sidescrolloff' doesn't work for mouse (#21162)
Missing part of Vim patch 8.1.0864.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/cursor.c9
-rw-r--r--src/nvim/normal.c10
2 files changed, 10 insertions, 9 deletions
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,
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 71fc7165ea..f993bf339b 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2768,7 +2768,7 @@ static void nv_zet(cmdarg_T *cap)
long old_fdl = curwin->w_p_fdl;
int old_fen = curwin->w_p_fen;
- int l_p_siso = (int)get_sidescrolloff_value(curwin);
+ int siso = (int)get_sidescrolloff_value(curwin);
if (ascii_isdigit(nchar) && !nv_z_get_count(cap, &nchar)) {
return;
@@ -2898,8 +2898,8 @@ static void nv_zet(cmdarg_T *cap)
} else {
getvcol(curwin, &curwin->w_cursor, &col, NULL, NULL);
}
- if (col > l_p_siso) {
- col -= l_p_siso;
+ if (col > siso) {
+ col -= siso;
} else {
col = 0;
}
@@ -2919,10 +2919,10 @@ static void nv_zet(cmdarg_T *cap)
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col);
}
n = curwin->w_width_inner - curwin_col_off();
- if (col + l_p_siso < n) {
+ if (col + siso < n) {
col = 0;
} else {
- col = col + l_p_siso - n + 1;
+ col = col + siso - n + 1;
}
if (curwin->w_leftcol != col) {
curwin->w_leftcol = col;