summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 11:43:34 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 11:43:34 +0000
commit72f8afdae4309b4a2522f83f5c96d0909f4038a0 (patch)
treebe14d2f127e8b5472b0928eee2815fe5ce23d20a /usr.bin/tmux
parente6067a65342859bdeda474215d5c768d7f60747a (diff)
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.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/window-copy.c12
1 files changed, 8 insertions, 4 deletions
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 <nicm@users.sourceforge.net>
@@ -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");