diff src/ops.c @ 10827:e366b968bf08 v8.0.0303

patch 8.0.0303: bracketed paste does not work in Visual mode commit https://github.com/vim/vim/commit/a1891848d970452cd775d35a4bccfdd9758a690a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 4 21:34:31 2017 +0100 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
author Christian Brabandt <cb@256bit.org>
date Sat, 04 Feb 2017 21:45:04 +0100
parents 065da86ca6d2
children f5bd684e47a1
line wrap: on
line diff
--- 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;
 	}