comparison 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
comparison
equal deleted inserted replaced
32287:d7ece013f34d 32288:8201b0fcea02
984 else if (amount_after && *lp > line2) \ 984 else if (amount_after && *lp > line2) \
985 *lp += amount_after; \ 985 *lp += amount_after; \
986 } 986 }
987 987
988 /* 988 /*
989 * Adjust marks between line1 and line2 (inclusive) to move 'amount' lines. 989 * Adjust marks between "line1" and "line2" (inclusive) to move "amount" lines.
990 * Must be called before changed_*(), appended_lines() or deleted_lines(). 990 * Must be called before changed_*(), appended_lines() or deleted_lines().
991 * May be called before or after changing the text. 991 * May be called before or after changing the text.
992 * When deleting lines line1 to line2, use an 'amount' of MAXLNUM: The marks 992 * When deleting lines "line1" to "line2", use an "amount" of MAXLNUM: The
993 * within this range are made invalid. 993 * marks within this range are made invalid.
994 * If 'amount_after' is non-zero adjust marks after line2. 994 * If "amount_after" is non-zero adjust marks after "line2".
995 * Example: Delete lines 34 and 35: mark_adjust(34, 35, MAXLNUM, -2); 995 * Example: Delete lines 34 and 35: mark_adjust(34, 35, MAXLNUM, -2);
996 * Example: Insert two lines below 55: mark_adjust(56, MAXLNUM, 2, 0); 996 * Example: Insert two lines below 55: mark_adjust(56, MAXLNUM, 2, 0);
997 * or: mark_adjust(56, 55, MAXLNUM, 2); 997 * or: mark_adjust(56, 55, MAXLNUM, 2);
998 */ 998 */
999 void 999 void
1129 if (line1 <= 1) 1129 if (line1 <= 1)
1130 win->w_topline = 1; 1130 win->w_topline = 1;
1131 else 1131 else
1132 win->w_topline = line1 - 1; 1132 win->w_topline = line1 - 1;
1133 } 1133 }
1134 else // keep topline on the same line 1134 else if (win->w_topline > line1)
1135 // keep topline on the same line, unless inserting just
1136 // above it (we probably want to see that line then)
1135 win->w_topline += amount; 1137 win->w_topline += amount;
1136 #ifdef FEAT_DIFF 1138 #ifdef FEAT_DIFF
1137 win->w_topfill = 0; 1139 win->w_topfill = 0;
1138 #endif 1140 #endif
1139 } 1141 }