From 72f8afdae4309b4a2522f83f5c96d0909f4038a0 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 25 Mar 2013 11:43:34 +0000 Subject: Create a new context when copying instead of using the input context. The input context may not exist yet. Fixes crash when copying from config file errors. --- usr.bin/tmux/window-copy.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index a5b597562fe..c098a0df037 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.90 2013/03/25 11:43:01 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.91 2013/03/25 11:43:33 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1385,10 +1385,14 @@ window_copy_get_selection(struct window_pane *wp, size_t *len) void window_copy_copy_buffer(struct window_pane *wp, int idx, void *buf, size_t len) { - u_int limit; + u_int limit; + struct screen_write_ctx ctx; - if (options_get_number(&global_options, "set-clipboard")) - screen_write_setselection(&wp->ictx.ctx, buf, len); + if (options_get_number(&global_options, "set-clipboard")) { + screen_write_start(&ctx, wp, NULL); + screen_write_setselection(&ctx, buf, len); + screen_write_stop(&ctx); + } if (idx == -1) { limit = options_get_number(&global_options, "buffer-limit"); -- cgit v1.2.3