summaryrefslogtreecommitdiffstats
path: root/input-keys.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-04-25 20:33:42 +0000
committerTiago Cunha <tcunha@gmx.com>2011-04-25 20:33:42 +0000
commit215ee46106bd8d5324cab659d74abeeee1127224 (patch)
treea5adf1cb2a31c2438b5a044f7bc0e81c76916fa5 /input-keys.c
parentd5150484d1ff6be13e4c4c5c399d44b0054755fa (diff)
Sync OpenBSD patchset 896:
When mode-mouse is on (it is off by default), automatically enter copy mode when the mouse is dragged or the mouse wheel is used. Also exit copy mode when the mouse wheel is scrolled off the bottom. Discussed with and written by hsim at gmx dot li.
Diffstat (limited to 'input-keys.c')
-rw-r--r--input-keys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/input-keys.c b/input-keys.c
index d18c4041..f799f09f 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -1,4 +1,4 @@
-/* $Id: input-keys.c,v 1.48 2011-01-07 14:34:45 tcunha Exp $ */
+/* $Id: input-keys.c,v 1.49 2011-04-25 20:33:42 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -219,5 +219,12 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
buf[len++] = m->y + 33;
}
bufferevent_write(wp->event, buf, len);
+ } else if ((m->b & MOUSE_BUTTON) != MOUSE_2) {
+ if (options_get_number(&wp->window->options, "mode-mouse") &&
+ window_pane_set_mode(wp, &window_copy_mode) == 0) {
+ window_copy_init_from_pane(wp);
+ if (wp->mode->mouse != NULL)
+ wp->mode->mouse(wp, NULL, m);
+ }
}
}