Problem: After CTRL-R CTRL-P (or CTRL-R CTRL-O) pastes a register
into Insert mode, a follow-up edit such as backspace makes
stop_arrow() rewrite Insstart with the post-paste cursor
position. As a result the '[ mark points at the end of the
inserted text instead of its start. Regression introduced
by patch 9.2.0384 while fixing #20031.
Solution: In stop_arrow(), only pull Insstart back when the cursor
moved above the previous Insstart, so a line-start backspace
can still save the joined range (#20031) without disturbing
the start position for inserts that advance the cursor
(#20130).
Fixes: #20130
Insstart = curwin->w_cursor afteru_save_cursor() in stop_arrow(). That fix was needed for<Cmd> cursor moves above the original Insstart (issue #20031), butCTRL-R CTRL-P register pastes that advance the'[ mark (issue #20130).Test_open_square_mark_after_ctrl_r_ctrl_p_paste insrc/testdir/test_undo.vim replays the exact key sequence from thegetpos("'["). Verified that reverting theTest_undo_line_backspace_after_insert_cmd_cursor_movement stillhttps://github.com/vim/vim/pull/20322
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
> @@ -967,6 +967,20 @@ func Test_undo_line_backspace_after_insert_cmd_edit() bwipe! endfunc +" Issue #20130: '[ must mark the start of the paste after CTRL-R CTRL-P + edit. +func Test_open_square_mark_after_ctrl_r_ctrl_p_paste()
I don't think test_undo.vim is the correct file for this test. It doesn't test the undo functionality. It's better to place it in test_edit.vim.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/edit.c:
> @@ -2512,11 +2512,14 @@ stop_arrow(void)
{
if (u_save_cursor() == OK)
{
- // A command or event may have moved the cursor or edited the
- // buffer. Update Insstart so that later edits can properly decide
- // whether an extra undo entry is needed.
- Insstart = curwin->w_cursor;
- Insstart_textlen = (colnr_T)linetabsize_str(ml_get_curline());
+ // A command or event may have moved the cursor before the next
+ // edit. Pull Insstart back only when the cursor moved above it.
The "so that later edits can properly decide whether an extra undo entry is needed" from the original comment is lost.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@h-east pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@h-east commented on this pull request.
> @@ -967,6 +967,20 @@ func Test_undo_line_backspace_after_insert_cmd_edit() bwipe! endfunc +" Issue #20130: '[ must mark the start of the paste after CTRL-R CTRL-P + edit. +func Test_open_square_mark_after_ctrl_r_ctrl_p_paste()
Moved.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@h-east commented on this pull request.
In src/edit.c:
> @@ -2512,11 +2512,14 @@ stop_arrow(void)
{
if (u_save_cursor() == OK)
{
- // A command or event may have moved the cursor or edited the
- // buffer. Update Insstart so that later edits can properly decide
- // whether an extra undo entry is needed.
- Insstart = curwin->w_cursor;
- Insstart_textlen = (colnr_T)linetabsize_str(ml_get_curline());
+ // A command or event may have moved the cursor before the next
+ // edit. Pull Insstart back only when the cursor moved above it.
Fixed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()