{
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,
+ // so that later edits can properly decide whether an extra undo
+ // entry is needed. Advancing Insstart would mis-place '[ after a
+ // register paste.
+ if (LT_POS(curwin->w_cursor, Insstart))
+ {
+ Insstart = curwin->w_cursor;
+ Insstart_textlen = (colnr_T)linetabsize_str(ml_get_curline());
+ }
ins_need_undo = FALSE;
}
}
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()
+ new
+ call setline(1, ['a', 'b', 'c', 'd'])
+ call cursor(4, 1)
+
+ call feedkeys("Vggyjo\<C-r>\<C-p>\"\<BS>\<Esc>", 'xt')
+
+ call assert_equal(['a', 'b', 'a', 'b', 'c', 'd', 'c', 'd'],
+ \ getline(1, '$'))
+ call assert_equal([0, 3, 1, 0], getpos("'["))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 533,
/**/
532,
/**/