about summary refs log tree commit diff
path: root/Src/Zle/zle_misc.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-07-23 05:30:36 +0200
committerOliver Kiddle <opk@zsh.org>2015-07-23 05:36:27 +0200
commitb4aff3bc52e15be87304183b3ae959668192b48c (patch)
treed8560e6f5d048386043f8471d48251fa4733b395 /Src/Zle/zle_misc.c
parenta925d036fca112c159e45b5965fa856e4ce9be55 (diff)
downloadzsh-b4aff3bc52e15be87304183b3ae959668192b48c.tar.gz
zsh-b4aff3bc52e15be87304183b3ae959668192b48c.tar.xz
zsh-b4aff3bc52e15be87304183b3ae959668192b48c.zip
35824: allow highlighting of just pasted text and put text from bracketed paste in cut buffers
Diffstat (limited to 'Src/Zle/zle_misc.c')
-rw-r--r--Src/Zle/zle_misc.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 556ce5ba6..502e41e35 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -517,10 +517,12 @@ copyregionaskill(char **args)
 
 /*
  * kct: index into kill ring, or -1 for original cutbuffer of yank.
- * yankb, yanke: mark the start and end of last yank in editing buffer.
  * yankcs marks the cursor position preceding the last yank
  */
-static int kct, yankb, yanke, yankcs;
+static int kct, yankcs;
+
+/**/
+int yankb, yanke; /* mark the start and end of last yank in editing buffer. */
 
 /* The original cutbuffer, either cutbuf or one of the vi buffers. */
 static Cutbuffer kctbuf;
@@ -778,10 +780,17 @@ bracketedpaste(char **args)
 	ZLE_STRING_T wpaste;
 	wpaste = stringaszleline((zmult == 1) ? pbuf :
 	    quotestring(pbuf, NULL, QT_BACKSLASH), 0, &n, NULL, NULL);
-	zmult = 1;
-	if (region_active)
-	    killregion(zlenoargs);
-	doinsert(wpaste, n);
+	cuttext(wpaste, n, CUT_REPLACE);
+	if (!(zmod.flags & MOD_VIBUF)) {
+	    kct = -1;
+	    kctbuf = &cutbuf;
+	    zmult = 1;
+	    if (region_active)
+		killregion(zlenoargs);
+	    yankcs = yankb = zlecs;
+	    doinsert(wpaste, n);
+	    yanke = zlecs;
+	}
 	free(pbuf); free(wpaste);
     }
     return 0;