diff options
author | 2014-05-08 07:59:16 +0000 | |
---|---|---|
committer | 2014-05-08 07:59:16 +0000 | |
commit | 1b3188008850094f21b3df8f6042ebf042fd0714 (patch) | |
tree | c2fa2e385b0a54c1923b487fed88f01d9ac5b1dd /usr.bin/tmux/input-keys.c | |
parent | Instead of forcing mouse scroll to 1 in choose mode, scale it down (diff) | |
download | wireguard-openbsd-1b3188008850094f21b3df8f6042ebf042fd0714.tar.xz wireguard-openbsd-1b3188008850094f21b3df8f6042ebf042fd0714.zip |
Send up and down keys for mouse wheel in alternate screen mode (when it
normally does nothing), from Marcel Partap.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r-- | usr.bin/tmux/input-keys.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c index 4362dcad3ba..307e970e459 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.36 2014/04/24 09:14:43 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.37 2014/05/08 07:59:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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) { /* |