From b4aff3bc52e15be87304183b3ae959668192b48c Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 23 Jul 2015 05:30:36 +0200 Subject: 35824: allow highlighting of just pasted text and put text from bracketed paste in cut buffers --- Src/Zle/zle_misc.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Src/Zle/zle_misc.c') 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; -- cgit v1.2.3