aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/textformat.c
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/textformat.c
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/textformat.c')
-rw-r--r--src/nvim/textformat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/textformat.c b/src/nvim/textformat.c
index 2cb08df7b5..41fb543994 100644
--- a/src/nvim/textformat.c
+++ b/src/nvim/textformat.c
@@ -157,7 +157,7 @@ void internal_format(int textwidth, int second_indent, int flags, bool format_on
}
// find column of textwidth border
- coladvance((colnr_T)textwidth);
+ coladvance(curwin, (colnr_T)textwidth);
wantcol = curwin->w_cursor.col;
// If startcol is large (a long line), formatting takes too much
@@ -690,9 +690,9 @@ void auto_format(bool trailblank, bool prev_line)
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) {
// "cannot happen"
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
- coladvance(MAXCOL);
+ coladvance(curwin, MAXCOL);
} else {
- check_cursor_col();
+ check_cursor_col(curwin);
}
// Insert mode: If the cursor is now after the end of the line while it
@@ -715,7 +715,7 @@ void auto_format(bool trailblank, bool prev_line)
}
}
- check_cursor();
+ check_cursor(curwin);
}
/// When an extra space was added to continue a paragraph for auto-formatting,
@@ -839,7 +839,7 @@ void op_format(oparg_T *oap, bool keep_cursor)
saved_cursor.lnum = 0;
// formatting may have made the cursor position invalid
- check_cursor();
+ check_cursor(curwin);
}
if (oap->is_VIsual) {
@@ -1063,7 +1063,7 @@ void format_lines(linenr_T line_count, bool avoid_fex)
// put cursor on last non-space
State = MODE_NORMAL; // don't go past end-of-line
- coladvance(MAXCOL);
+ coladvance(curwin, MAXCOL);
while (curwin->w_cursor.col && ascii_isspace(gchar_cursor())) {
dec_cursor();
}