aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/change.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-03-11 13:19:49 +0100
committerbfredl <bjorn.linse@gmail.com>2024-03-13 07:19:59 +0100
commit08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9 (patch)
tree73da66dcd1ba85b22d88b547b58f920039b167ad /src/nvim/change.c
parentd5488633f68fcfd58b4bcad654ab103b4746204b (diff)
downloadrneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.tar.gz
rneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.tar.bz2
rneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.zip
fix(api/buffer): fix handling of viewport of non-current buffer
A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
Diffstat (limited to 'src/nvim/change.c')
-rw-r--r--src/nvim/change.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 8b1e7587de..673907fa27 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -707,7 +707,7 @@ void ins_char(int c)
void ins_char_bytes(char *buf, size_t charlen)
{
// Break tabs if needed.
- if (virtual_active() && curwin->w_cursor.coladd > 0) {
+ if (virtual_active(curwin) && curwin->w_cursor.coladd > 0) {
coladvance_force(getviscol());
}
@@ -815,7 +815,7 @@ void ins_str(char *s)
int newlen = (int)strlen(s);
linenr_T lnum = curwin->w_cursor.lnum;
- if (virtual_active() && curwin->w_cursor.coladd > 0) {
+ if (virtual_active(curwin) && curwin->w_cursor.coladd > 0) {
coladvance_force(getviscol());
}
@@ -918,7 +918,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
// fixpos is true, we don't want to end up positioned at the NUL,
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
if (col > 0 && fixpos && restart_edit == 0
- && (get_ve_flags() & VE_ONEMORE) == 0) {
+ && (get_ve_flags(curwin) & VE_ONEMORE) == 0) {
curwin->w_cursor.col--;
curwin->w_cursor.coladd = 0;
curwin->w_cursor.col -= utf_head_off(oldp, oldp + curwin->w_cursor.col);