From 5f3160d186db4f1ae48ab929196db5f1e30a6b82 Mon Sep 17 00:00:00 2001 From: Jeff Westfahl Date: Mon, 27 Jun 2016 09:58:16 -0500 Subject: [PATCH] Speed up clipboard copies. Copying large scrollback buffers to the clipboard can take a long time, up to several minutes. Doubling the size of the clipboard copy buffer when more space is needed, instead of just adding a small constant size, significantly speeds up clipboard copies of large scrollback buffers. --- terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminal.c b/terminal.c index 7a444b71..5b37fe79 100644 --- a/terminal.c +++ b/terminal.c @@ -5445,7 +5445,7 @@ typedef struct { static void clip_addchar(clip_workbuf *b, wchar_t chr, int attr) { if (b->bufpos >= b->buflen) { - b->buflen += 128; + b->buflen *= 2; b->textbuf = sresize(b->textbuf, b->buflen, wchar_t); b->textptr = b->textbuf + b->bufpos; b->attrbuf = sresize(b->attrbuf, b->buflen, int);