diff options
-rw-r--r-- | usr.bin/tmux/cmd-paste-buffer.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/input-keys.c | 26 | ||||
-rw-r--r-- | usr.bin/tmux/paste.c | 6 |
3 files changed, 17 insertions, 21 deletions
diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c index 6e3cfff1c2a..aa09f906262 100644 --- a/usr.bin/tmux/cmd-paste-buffer.c +++ b/usr.bin/tmux/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-paste-buffer.c,v 1.26 2014/10/20 22:29:25 nicm Exp $ */ +/* $OpenBSD: cmd-paste-buffer.c,v 1.27 2014/11/05 23:25:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -49,7 +49,6 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) struct session *s; struct paste_buffer *pb; const char *sepstr, *bufname; - int pflag; if (cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp) == NULL) return (CMD_RETURN_ERROR); @@ -76,8 +75,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) else sepstr = "\r"; } - pflag = (wp->screen->mode & MODE_BRACKETPASTE); - paste_send_pane(pb, wp, sepstr, args_has(args, 'p') && pflag); + paste_send_pane(pb, wp, sepstr, args_has(args, 'p')); } /* Delete the buffer if -d. */ diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c index c053f2b8b36..ddbcfdb10f8 100644 --- a/usr.bin/tmux/input-keys.c +++ b/usr.bin/tmux/input-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input-keys.c,v 1.39 2014/07/21 20:45:35 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.40 2014/11/05 23:25:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -205,6 +205,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) char buf[40]; size_t len; struct paste_buffer *pb; + int event; if (wp->screen->mode & ALL_MOUSE_MODES) { /* @@ -238,19 +239,16 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m) return; } - if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) && - options_get_number(&wp->window->options, "mode-mouse") == 1) { + if (options_get_number(&wp->window->options, "mode-mouse") != 1) + return; + event = m->event & (MOUSE_EVENT_CLICK|MOUSE_EVENT_WHEEL); + if (wp->mode == NULL && m->button == 1 && event == MOUSE_EVENT_CLICK) { pb = paste_get_top(); - if (pb != NULL) { - paste_send_pane(pb, wp, "\r", - wp->screen->mode & MODE_BRACKETPASTE); - } - } else if (m->button != 1 && - options_get_number(&wp->window->options, "mode-mouse") == 1) { - if (window_pane_set_mode(wp, &window_copy_mode) == 0) { - window_copy_init_from_pane(wp); - if (wp->mode->mouse != NULL) - wp->mode->mouse(wp, s, m); - } + if (pb != NULL) + paste_send_pane(pb, wp, "\r", 1); + } else if (window_pane_set_mode(wp, &window_copy_mode) == 0) { + window_copy_init_from_pane(wp); + if (wp->mode->mouse != NULL) + wp->mode->mouse(wp, s, m); } } diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c index 7f88c147478..c779048e149 100644 --- a/usr.bin/tmux/paste.c +++ b/usr.bin/tmux/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.25 2014/10/08 17:35:58 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.26 2014/11/05 23:25:02 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -301,7 +301,7 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, if (wp->flags & PANE_INPUTOFF) return; - if (bracket) + if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) bufferevent_write(wp->event, "\033[200~", 6); seplen = strlen(sep); @@ -315,6 +315,6 @@ paste_send_pane(struct paste_buffer *pb, struct window_pane *wp, if (end != data) bufferevent_write(wp->event, data, end - data); - if (bracket) + if (bracket && (wp->screen->mode & MODE_BRACKETPASTE)) bufferevent_write(wp->event, "\033[201~", 6); } |