summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-04 21:34:31 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-04 21:34:31 +0100
commita1891848d970452cd775d35a4bccfdd9758a690a (patch)
treea4f34fe283b391afa71e8a735b10e161077e953d /src/ops.c
parente353c402e63b9b0a0bc06acf390e352d9e7eeaeb (diff)
downloadvim-a1891848d970452cd775d35a4bccfdd9758a690a.zip
patch 8.0.0303: bracketed paste does not work in Visual mode
Problem: Bracketed paste does not work in Visual mode. Solution: Delete the text before pasting
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ops.c b/src/ops.c
index 1c0276d8d..d23b3077f 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1628,6 +1628,22 @@ adjust_clip_reg(int *rp)
#endif
/*
+ * Shift the delete registers: "9 is cleared, "8 becomes "9, etc.
+ */
+ void
+shift_delete_registers()
+{
+ int n;
+
+ y_current = &y_regs[9];
+ free_yank_all(); /* free register nine */
+ for (n = 9; n > 1; --n)
+ y_regs[n] = y_regs[n - 1];
+ y_previous = y_current = &y_regs[1];
+ y_regs[1].y_array = NULL; /* set register one to empty */
+}
+
+/*
* Handle a delete operation.
*
* Return FAIL if undo failed, OK otherwise.
@@ -1739,12 +1755,7 @@ op_delete(oparg_T *oap)
if (orig_regname != 0 || oap->motion_type == MLINE
|| oap->line_count > 1 || oap->use_reg_one)
{
- y_current = &y_regs[9];
- free_yank_all(); /* free register nine */
- for (n = 9; n > 1; --n)
- y_regs[n] = y_regs[n - 1];
- y_previous = y_current = &y_regs[1];
- y_regs[1].y_array = NULL; /* set register one to empty */
+ shift_delete_registers();
if (op_yank(oap, TRUE, FALSE) == OK)
did_yank = TRUE;
}