diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-03-11 13:19:49 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-03-13 07:19:59 +0100 |
commit | 08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9 (patch) | |
tree | 73da66dcd1ba85b22d88b547b58f920039b167ad /src/nvim/textobject.c | |
parent | d5488633f68fcfd58b4bcad654ab103b4746204b (diff) | |
download | rneovim-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/textobject.c')
-rw-r--r-- | src/nvim/textobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/textobject.c b/src/nvim/textobject.c index d9c2b3b111..8ac63aad16 100644 --- a/src/nvim/textobject.c +++ b/src/nvim/textobject.c @@ -187,7 +187,7 @@ bool findpar(bool *pincl, int dir, int count, int what, bool both) // skip folded lines fold_skipped = false; - if (first && hasFolding(curr, &fold_first, &fold_last)) { + if (first && hasFolding(curwin, curr, &fold_first, &fold_last)) { curr = ((dir > 0) ? fold_last : fold_first) + dir; fold_skipped = true; } @@ -318,8 +318,8 @@ int fwd_word(int count, bool bigword, bool eol) while (--count >= 0) { // When inside a range of folded lines, move to the last char of the // last line. - if (hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) { - coladvance(MAXCOL); + if (hasFolding(curwin, curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) { + coladvance(curwin, MAXCOL); } int sclass = cls(); // starting class @@ -374,7 +374,7 @@ int bck_word(int count, bool bigword, bool stop) while (--count >= 0) { // When inside a range of folded lines, move to the first char of the // first line. - if (hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL)) { + if (hasFolding(curwin, curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL)) { curwin->w_cursor.col = 0; } sclass = cls(); @@ -431,8 +431,8 @@ int end_word(int count, bool bigword, bool stop, bool empty) while (--count >= 0) { // When inside a range of folded lines, move to the last char of the // last line. - if (hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) { - coladvance(MAXCOL); + if (hasFolding(curwin, curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum)) { + coladvance(curwin, MAXCOL); } sclass = cls(); if (inc_cursor() == -1) { |