vim-patch:8.0.1575: crash when using virtual replace

Problem:    Crash when using virtual replace.
Solution:   Adjust orig_line_count.  Add more tests. (Christian Brabandt)
63e82db6fc
This commit is contained in:
Jan Edmund Lazo
2018-07-14 18:32:40 -04:00
parent 7f2e352700
commit f53c2578e7
2 changed files with 64 additions and 2 deletions

View File

@@ -7486,6 +7486,13 @@ static void ins_del(void)
vim_beep(BO_BS);
} else {
curwin->w_cursor.col = temp;
// 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;
}
}
} else if (del_char(false) == FAIL) { // delete char under cursor
vim_beep(BO_BS);