about summary refs log tree commit diff
path: root/Src/Zle/zle_hist.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-06-19 00:15:38 +0200
committerOliver Kiddle <opk@zsh.org>2015-06-19 00:15:38 +0200
commit98687fa1dec803f041cbb5417c146d8aa5129b53 (patch)
treee62c09baa6ea0717677e7bad7adf3a64423cba5a /Src/Zle/zle_hist.c
parent0a0ba5e6641a8a78d745928e5738c95cc5353ee0 (diff)
downloadzsh-98687fa1dec803f041cbb5417c146d8aa5129b53.tar.gz
zsh-98687fa1dec803f041cbb5417c146d8aa5129b53.tar.xz
zsh-98687fa1dec803f041cbb5417c146d8aa5129b53.zip
35474, 35492: support the bracketed paste mode of newer terminal emulators
Diffstat (limited to 'Src/Zle/zle_hist.c')
-rw-r--r--Src/Zle/zle_hist.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index 0b3b9e7b7..ffb7ce98f 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -1620,6 +1620,21 @@ doisearch(char **args, int dir, int pattern)
 		feep = 1;
 	    else
 		goto ins;
+	} else if (cmd == Th(z_bracketedpaste)) {
+	    char *paste = bracketedstring();
+	    set_isrch_spot(top_spot++, hl, pos, pat_hl, pat_pos, end_pos,
+			   zlemetacs, sbptr, dir, nomatch);
+	    size_t pastelen = strlen(paste);
+	    if (sbptr + pastelen >= sibuf - FIRST_SEARCH_CHAR - 2) {
+		int oldsize = sibuf;
+		sibuf += (pastelen >= sibuf) ? pastelen + 1 : sibuf;
+		ibuf = hrealloc(ibuf, oldsize, sibuf);
+		sbuf = ibuf + FIRST_SEARCH_CHAR;
+	    }
+	    strcpy(sbuf + sbptr, paste);
+	    sbptr += pastelen;
+	    patprog = NULL;
+	    free(paste);
 	} else if (cmd == Th(z_acceptsearch)) {
 	    break;
 	} else {