aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.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/diff.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/diff.c')
-rw-r--r--src/nvim/diff.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 2b3010e063..bc91c1e4c2 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1347,7 +1347,7 @@ void ex_diffsplit(exarg_T *eap)
set_bufref(&old_curbuf, curbuf);
// Need to compute w_fraction when no redraw happened yet.
- validate_cursor();
+ validate_cursor(curwin);
set_fraction(curwin);
// don't use a new tab page, each tab page has its own diffs
@@ -1457,7 +1457,7 @@ void diff_win_options(win_T *wp, bool addbuf)
foldUpdateAll(wp);
// make sure topline is not halfway through a fold
- changed_window_setting_win(wp);
+ changed_window_setting(wp);
if (vim_strchr(p_sbo, 'h') == NULL) {
do_cmdline_cmd("set sbo+=hor");
}
@@ -1522,7 +1522,7 @@ void ex_diffoff(exarg_T *eap)
// make sure topline is not halfway a fold and cursor is
// invalidated
- changed_window_setting_win(wp);
+ changed_window_setting(wp);
// Note: 'sbo' is not restored, it's a global option.
diff_buf_adjust(wp);
@@ -2137,7 +2137,7 @@ int diff_check_with_linestatus(win_T *wp, linenr_T lnum, int *linestatus)
}
// A closed fold never has filler lines.
- if (hasFoldingWin(wp, lnum, NULL, NULL, true, NULL)) {
+ if (hasFolding(wp, lnum, NULL, NULL)) {
return 0;
}
@@ -2451,8 +2451,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin)
changed_line_abv_curs_win(towin);
check_topfill(towin, false);
- hasFoldingWin(towin, towin->w_topline, &towin->w_topline,
- NULL, true, NULL);
+ hasFolding(towin, towin->w_topline, &towin->w_topline, NULL);
}
/// This is called when 'diffopt' is changed.
@@ -2988,7 +2987,7 @@ theend:
// Check that the cursor is on a valid character and update its
// position. When there were filler lines the topline has become
// invalid.
- check_cursor();
+ check_cursor(curwin);
changed_line_abv_curs();
if (diff_need_update) {