summaryrefslogtreecommitdiffstats
path: root/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm>2014-05-08 07:59:16 +0000
committernicm <nicm>2014-05-08 07:59:16 +0000
commit353d1825d5a3a6efb1c3c71d9afbb96ba57cc948 (patch)
tree3e0d09ae42ba99b3d552d1f82fae5c2100b28cec /input-keys.c
parent94ccc6aeaa72c84d66436d3f0cd23b4ab4d69c8e (diff)
Send up and down keys for mouse wheel in alternate screen mode (when it
normally does nothing), from Marcel Partap.
Diffstat (limited to 'input-keys.c')
-rw-r--r--input-keys.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/input-keys.c b/input-keys.c
index 6e21cc0c..24566dfd 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -205,6 +205,21 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
char buf[40];
size_t len;
struct paste_buffer *pb;
+ u_int i;
+
+ /*
+ * If the alternate screen is active and hasn't enabled the mouse, send
+ * up and down key presses for the mouse wheel.
+ */
+ if (wp->saved_grid != NULL && !(wp->screen->mode & ALL_MOUSE_MODES)) {
+ for (i = 0; i < m->scroll; i++) {
+ if (m->wheel == MOUSE_WHEEL_UP)
+ input_key(wp, KEYC_UP);
+ else
+ input_key(wp, KEYC_DOWN);
+ }
+ return;
+ }
if (wp->screen->mode & ALL_MOUSE_MODES) {
/*