summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2014-11-05 23:25:02 +0000
committernicm <nicm@openbsd.org>2014-11-05 23:25:02 +0000
commit75cb6554571fcafb212f9714a206c672ac193767 (patch)
tree52770bb28bf64b322cb6165f5650d8a77881f032 /usr.bin/tmux/input-keys.c
parentDo not put a space between status-left/status-right and the window list, (diff)
downloadwireguard-openbsd-75cb6554571fcafb212f9714a206c672ac193767.tar.xz
wireguard-openbsd-75cb6554571fcafb212f9714a206c672ac193767.zip
Tidy up mode-mouse check.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r--usr.bin/tmux/input-keys.c26
1 files changed, 12 insertions, 14 deletions
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);
}
}