aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/buffer.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-08-27 13:56:20 +0200
committerGitHub <noreply@github.com>2023-08-27 13:56:20 +0200
commit4c69279f97e566277a33b81146b26b7ca20de4f3 (patch)
treee9ed01feacbc4be34b96faf46e4baa1a8c83de16 /src/nvim/api/buffer.c
parentb7d5b55f74fd589dee27d8356d45b31c552705c3 (diff)
parent840749d6c971f93aa9744bd6f76b383f11043463 (diff)
downloadrneovim-4c69279f97e566277a33b81146b26b7ca20de4f3.tar.gz
rneovim-4c69279f97e566277a33b81146b26b7ca20de4f3.tar.bz2
rneovim-4c69279f97e566277a33b81146b26b7ca20de4f3.zip
Merge pull request #24889 from bfredl/topline
fix(api): fix issues with nvim_buf_set_lines refactor
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r--src/nvim/api/buffer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 775b6e8ea7..d36f0dd050 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -472,9 +472,11 @@ void nvim_buf_set_lines(uint64_t channel_id, Buffer buffer, Integer start, Integ
kExtmarkUndo);
changed_lines(buf, (linenr_T)start, 0, (linenr_T)end, (linenr_T)extra, true);
- if (curwin->w_buffer == buf) {
- // mark_adjust_buf handles non-current windows
- fix_cursor(curwin, (linenr_T)start, (linenr_T)end, (linenr_T)extra);
+
+ FOR_ALL_TAB_WINDOWS(tp, win) {
+ if (win->w_buffer == buf) {
+ fix_cursor(win, (linenr_T)start, (linenr_T)end, (linenr_T)extra);
+ }
}
end:
@@ -710,7 +712,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
// changed range, and move any in the remainder of the buffer.
// Do not adjust any cursors. need to use column-aware logic (below)
mark_adjust_buf(buf, (linenr_T)start_row, (linenr_T)end_row, MAXLNUM, (linenr_T)extra,
- true, false, kExtmarkNOOP);
+ true, true, kExtmarkNOOP);
extmark_splice(buf, (int)start_row - 1, (colnr_T)start_col,
(int)(end_row - start_row), col_extent, old_byte,