diff src/mark.c @ 32288:8201b0fcea02 v9.0.1476

patch 9.0.1476: lines put in non-current window are not displayed Commit: https://github.com/vim/vim/commit/e7f05a8780426dc7af247419c6d02d5f1e896689 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 22 15:35:28 2023 +0100 patch 9.0.1476: lines put in non-current window are not displayed Problem: Lines put in non-current window are not displayed. (Marius Gedminas) Solution: Don't increment the topline when inserting just above it. (closes #12212)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Apr 2023 16:45:05 +0200
parents 238ca27dbfd2
children 1f3bcb7f3bd0
line wrap: on
line diff
--- a/src/mark.c
+++ b/src/mark.c
@@ -986,12 +986,12 @@ ex_changes(exarg_T *eap UNUSED)
     }
 
 /*
- * 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);
@@ -1131,7 +1131,9 @@ mark_adjust_internal(
 			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;
 #ifdef FEAT_DIFF
 		    win->w_topfill = 0;