Bram,
this example throws ml_get errors:
,----
| set bs=2
| exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz"
| call cursor(1,1)
| exe "normal gR0\<del> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR"
`----
Problem is, that once a linebreak is deleted in virtual replace mode,
orig_lines_count is not correctly reset.
Here is a patch that fixes that issue and includes a test.
diff --git a/src/edit.c b/src/edit.c
index 47227d34b..10bfd08a1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -8927,7 +8927,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
+ if (State & VREPLACE_FLAG)
+ {
+ orig_line_count = curbuf->b_ml.ml_line_count;
+ if (vr_lines_changed > 1)
+ vr_lines_changed--;
+ }
+#endif
+ }
}
else if (del_char(FALSE) == FAIL) /* delete char under cursor */
vim_beep(BO_BS);
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 4287a9e49..d7e9bc7e5 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -186,4 +186,22 @@ func Test_virtual_replace()
call assert_equal(['AB......CDEFGHI.Jkl',
\ 'AB IJKLMNO QRst'], getline(12, 13))
enew!
+ set noai bs&vim t_kD&vim t_kb&vim
+endfunc
+
+" Test Virtual replace mode.
+func Test_virtual_replace2()
+ enew!
+ exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\<C-D>uvwxyz"
+ call cursor(1,1)
+ set bs=2
+ exe "normal gR0\<del> 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR"
+ call assert_equal(['0 1',
+ \ 'A',
+ \ 'BCDEFGHIJ',
+ \ ' KL',
+ \ 'MNO',
+ \ 'PQR',
+ \ ], getline(1, 6))
+ set bs&vim
endfunc
However I am not sure, vr_lines_changed should be decremented.
Problem was discovered in Neovim Bugtracker:
https://github.com/neovim/neovim/issues/8000
Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Polly Zei
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.