aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/search.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/search.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/search.c')
-rw-r--r--src/nvim/search.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 2fea28ba7c..a3c9da8e3b 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -1076,11 +1076,11 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, int count, in
// If the cursor is in a closed fold, don't find another match in the same
// fold.
if (dirc == '/') {
- if (hasFolding(pos.lnum, NULL, &pos.lnum)) {
+ if (hasFolding(curwin, pos.lnum, NULL, &pos.lnum)) {
pos.col = MAXCOL - 2; // avoid overflow when adding 1
}
} else {
- if (hasFolding(pos.lnum, &pos.lnum, NULL)) {
+ if (hasFolding(curwin, pos.lnum, &pos.lnum, NULL)) {
pos.col = 0;
}
}
@@ -1389,7 +1389,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char *pat, int count, in
show_top_bot_msg, msgbuf,
(count != 1 || has_offset
|| (!(fdo_flags & FDO_SEARCH)
- && hasFolding(curwin->w_cursor.lnum, NULL,
+ && hasFolding(curwin, curwin->w_cursor.lnum, NULL,
NULL))),
SEARCH_STAT_DEF_MAX_COUNT,
SEARCH_STAT_DEF_TIMEOUT);
@@ -4034,7 +4034,7 @@ search_line:
setpcmark();
}
curwin->w_cursor.lnum = lnum;
- check_cursor();
+ check_cursor(curwin);
} else {
if (!GETFILE_SUCCESS(getfile(0, files[depth].name, NULL, true,
files[depth].lnum, forceit))) {
@@ -4053,7 +4053,7 @@ search_line:
if (l_g_do_tagpreview != 0
&& curwin != curwin_save && win_valid(curwin_save)) {
// Return cursor to where we were
- validate_cursor();
+ validate_cursor(curwin);
redraw_later(curwin, UPD_VALID);
win_enter(curwin_save, true);
}