aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-14 18:32:40 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-06 21:56:39 -0400
commitf53c2578e79877376259390840ccce56963251c4 (patch)
tree6a6b872799040d76fa70a7eab32316f043eabead /src/nvim/edit.c
parent7f2e3527007580e6885b0fd6253aefba13e74a60 (diff)
downloadrneovim-f53c2578e79877376259390840ccce56963251c4.tar.gz
rneovim-f53c2578e79877376259390840ccce56963251c4.tar.bz2
rneovim-f53c2578e79877376259390840ccce56963251c4.zip
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) https://github.com/vim/vim/commit/63e82db6fc910b2d8f1cd018894e50e8b4448155
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 95c903c90c..4945b2b3c8 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -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);