summaryrefslogtreecommitdiff
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-06 12:10:48 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-06 12:10:48 +0100
commit63e82db6fc910b2d8f1cd018894e50e8b4448155 (patch)
treeecd9a84d5303a6712e599ba7f9b6ba0bd679804c /src/edit.c
parent987723e084660290270b3c3d943eb13bd828d5da (diff)
downloadvim-git-63e82db6fc910b2d8f1cd018894e50e8b4448155.tar.gz
patch 8.0.1575: crash when using virtual replacev8.0.1575
Problem: Crash when using virtual replace. Solution: Adjust orig_line_count. Add more tests. (Christian Brabandt)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/edit.c b/src/edit.c
index 423ccea44..21941cb3d 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -8907,7 +8907,17 @@ ins_del(void)
|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
vim_beep(BO_BS);
else
+ {
curwin->w_cursor.col = temp;
+#ifdef FEAT_VREPLACE
+ /* Adjust orig_line_count in case more lines have been deleted than
+ * have been added. That makes sure, that open_line() later
+ * can access all buffer lines correctly */
+ if (State & VREPLACE_FLAG &&
+ orig_line_count > curbuf->b_ml.ml_line_count)
+ orig_line_count = curbuf->b_ml.ml_line_count;
+#endif
+ }
}
else if (del_char(FALSE) == FAIL) /* delete char under cursor */
vim_beep(BO_BS);