aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-03-13 07:46:11 +0100
committerGitHub <noreply@github.com>2024-03-13 07:46:11 +0100
commit2a8cef6bd450febd88d754e0c1909137b7451757 (patch)
tree73da66dcd1ba85b22d88b547b58f920039b167ad /src/nvim/eval
parentd5488633f68fcfd58b4bcad654ab103b4746204b (diff)
parent08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9 (diff)
downloadrneovim-2a8cef6bd450febd88d754e0c1909137b7451757.tar.gz
rneovim-2a8cef6bd450febd88d754e0c1909137b7451757.tar.bz2
rneovim-2a8cef6bd450febd88d754e0c1909137b7451757.zip
Merge pull request #27815 from bfredl/setlines_scroll
fix(api/buffer): fix handling of viewport of non-current buffer
Diffstat (limited to 'src/nvim/eval')
-rw-r--r--src/nvim/eval/buffer.c6
-rw-r--r--src/nvim/eval/funcs.c16
-rw-r--r--src/nvim/eval/window.c12
3 files changed, 17 insertions, 17 deletions
diff --git a/src/nvim/eval/buffer.c b/src/nvim/eval/buffer.c
index 7b8f71ef3f..73bfd6db2a 100644
--- a/src/nvim/eval/buffer.c
+++ b/src/nvim/eval/buffer.c
@@ -197,7 +197,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, typval_
&& ml_replace(lnum, line, true) == OK) {
inserted_bytes(lnum, 0, old_len, (int)strlen(line));
if (is_curbuf && lnum == curwin->w_cursor.lnum) {
- check_cursor_col();
+ check_cursor_col(curwin);
}
rettv->vval.v_number = 0; // OK
}
@@ -229,7 +229,7 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append, typval_
wp->w_cursor.lnum += (linenr_T)added;
}
}
- check_cursor_col();
+ check_cursor_col(curwin);
update_topline(curwin);
}
@@ -469,7 +469,7 @@ void f_deletebufline(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
}
}
}
- check_cursor_col();
+ check_cursor_col(curwin);
deleted_lines_mark(first, count);
rettv->vval.v_number = 0; // OK
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 1d5835c9bf..99da15ddd7 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -727,7 +727,7 @@ static void get_col(typval_T *argvars, typval_T *rettv, bool charcol)
return;
}
- check_cursor();
+ check_cursor(curwin);
winchanged = true;
}
@@ -746,7 +746,7 @@ static void get_col(typval_T *argvars, typval_T *rettv, bool charcol)
col = fp->col + 1;
// col(".") when the cursor is on the NUL at the end of the line
// because of "coladd" can be seen as an extra column.
- if (virtual_active() && fp == &curwin->w_cursor) {
+ if (virtual_active(curwin) && fp == &curwin->w_cursor) {
char *p = get_cursor_pos_ptr();
if (curwin->w_cursor.coladd >=
(colnr_T)win_chartabsize(curwin, p,
@@ -1191,7 +1191,7 @@ static void set_cursorpos(typval_T *argvars, typval_T *rettv, bool charcol)
curwin->w_cursor.coladd = coladd;
// Make sure the cursor is in a valid position.
- check_cursor();
+ check_cursor(curwin);
// Correct cursor for multi-byte character.
mb_adjust_cursor();
@@ -2890,7 +2890,7 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
curbuf = findbuf;
curwin->w_buffer = curbuf;
const TriState save_virtual = virtual_op;
- virtual_op = virtual_active();
+ virtual_op = virtual_active(curwin);
// NOTE: Adjust is needed.
p1.col--;
@@ -4643,7 +4643,7 @@ static void f_line(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (wp != NULL && tp != NULL) {
switchwin_T switchwin;
if (switch_win_noblock(&switchwin, wp, tp, true) == OK) {
- check_cursor();
+ check_cursor(curwin);
fp = var2fpos(&argvars[0], true, &fnum, false);
}
restore_win_noblock(&switchwin, true);
@@ -7029,7 +7029,7 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
}
// "/$" will put the cursor after the end of the line, may need to
// correct that here
- check_cursor();
+ check_cursor(curwin);
}
// If 'n' flag is used: restore cursor position.
@@ -7791,7 +7791,7 @@ static void set_position(typval_T *argvars, typval_T *rettv, bool charpos)
curwin->w_curswant = curswant - 1;
curwin->w_set_curswant = false;
}
- check_cursor();
+ check_cursor(curwin);
rettv->vval.v_number = 0;
} else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) {
// set mark
@@ -9204,7 +9204,7 @@ static void f_virtcol(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
goto theend;
}
- check_cursor();
+ check_cursor(curwin);
winchanged = true;
}
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index 3e2f6301ca..68de40f983 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -516,7 +516,7 @@ bool win_execute_before(win_execute_T *args, win_T *wp, tabpage_T *tp)
}
if (switch_win_noblock(&args->switchwin, wp, tp, true) == OK) {
- check_cursor();
+ check_cursor(curwin);
return true;
}
return false;
@@ -540,7 +540,7 @@ void win_execute_after(win_execute_T *args)
// In case the command moved the cursor or changed the Visual area,
// check it is valid.
- check_cursor();
+ check_cursor(curwin);
if (VIsual_active) {
check_pos(curbuf, &VIsual);
}
@@ -774,7 +774,7 @@ void f_winbufnr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "wincol()" function
void f_wincol(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- validate_cursor();
+ validate_cursor(curwin);
rettv->vval.v_number = curwin->w_wcol + 1;
}
@@ -811,7 +811,7 @@ void f_winlayout(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// "winline()" function
void f_winline(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{
- validate_cursor();
+ validate_cursor(curwin);
rettv->vval.v_number = curwin->w_wrow + 1;
}
@@ -883,10 +883,10 @@ void f_winrestview(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
curwin->w_skipcol = (colnr_T)tv_get_number(&di->di_tv);
}
- check_cursor();
+ check_cursor(curwin);
win_new_height(curwin, curwin->w_height);
win_new_width(curwin, curwin->w_width);
- changed_window_setting();
+ changed_window_setting(curwin);
if (curwin->w_topline <= 0) {
curwin->w_topline = 1;