aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-23 00:30:52 +0800
committerGitHub <noreply@github.com>2023-04-23 00:30:52 +0800
commit040d9da5c8f4d56e0482758223ea7bb04dc90cc0 (patch)
tree2bc921c0a0977805e741d1afb52c547f0a7fb95d /src/nvim/mark.c
parent1cb46abff1e903e999105b244329f22678ba8a30 (diff)
downloadrneovim-040d9da5c8f4d56e0482758223ea7bb04dc90cc0.tar.gz
rneovim-040d9da5c8f4d56e0482758223ea7bb04dc90cc0.tar.bz2
rneovim-040d9da5c8f4d56e0482758223ea7bb04dc90cc0.zip
vim-patch:9.0.1476: lines put in non-current window are not displayed (#23265)
Problem: Lines put in non-current window are not displayed. (Marius Gedminas) Solution: Don't increment the topline when inserting just above it. (closes vim/vim#12212) https://github.com/vim/vim/commit/e7f05a8780426dc7af247419c6d02d5f1e896689 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r--src/nvim/mark.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 59ff3026b3..7b79081dd9 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -1100,12 +1100,12 @@ void ex_changes(exarg_T *eap)
} \
}
-// Adjust marks between line1 and line2 (inclusive) to move 'amount' lines.
+// Adjust marks between "line1" and "line2" (inclusive) to move "amount" lines.
// Must be called before changed_*(), appended_lines() or deleted_lines().
// May be called before or after changing the text.
-// When deleting lines line1 to line2, use an 'amount' of MAXLNUM: The marks
-// within this range are made invalid.
-// If 'amount_after' is non-zero adjust marks after line2.
+// When deleting lines "line1" to "line2", use an "amount" of MAXLNUM: The
+// marks within this range are made invalid.
+// If "amount_after" is non-zero adjust marks after "line2".
// Example: Delete lines 34 and 35: mark_adjust(34, 35, MAXLNUM, -2);
// Example: Insert two lines below 55: mark_adjust(56, MAXLNUM, 2, 0);
// or: mark_adjust(56, 55, MAXLNUM, 2);
@@ -1240,7 +1240,9 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, linenr_T amount
} else {
win->w_topline = line1 - 1;
}
- } else { // keep topline on the same line
+ } else if (win->w_topline > line1) {
+ // keep topline on the same line, unless inserting just
+ // above it (we probably want to see that line then)
win->w_topline += amount;
}
win->w_topfill = 0;