Thanks for your quick review & good catch, please try again with
attached revision. c;
#Regards!
P.S.: [some patch NIH broke the command history in alternate screen..]
>From 48c5d8b8bf332b3f67f77154561a36027e013198 Mon Sep 17 00:00:00 2001
From: Marcel Partap <mpar...@gmx.net>
Date: Mon, 17 Feb 2014 22:02:14 +0100
Subject: [PATCH] Implement simple mouse wheel emulation, 2nd.
---
input-keys.c | 17 +++++++++++++++++
tmux.h | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/input-keys.c b/input-keys.c
index 7582a63..4d05f69 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -204,6 +204,23 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
char buf[40];
size_t len;
struct paste_buffer *pb;
+ int i, lines, factor;
+
+ if (m->event == MOUSE_EVENT_WHEEL) {
+ /* Alternate screen is active and not mouse aware, or shift is pressed. */
+ if ((wp->saved_grid && !(wp->screen->mode & ALL_MOUSE_MODES)) ||
+ m->xb & MOUSE_SHIFT) {
+ factor = 3;
+ /* wheel + SHIFT: scroll single line, else three. */
+ lines = (m->xb & MOUSE_SHIFT) ? 1 : factor;
+ /* wheel + META or CTRL: speed up by factor 3. */
+ lines *= (m->xb & MOUSE_ESCAPE) ? factor : 1;
+ lines *= (m->xb & MOUSE_CTRL) ? factor : 1;
+ for (i = 0; i < lines; i++)
+ input_key(wp, m->wheel == MOUSE_WHEEL_UP ? KEYC_UP : KEYC_DOWN);
+ return;
+ }
+ }
if (wp->screen->mode & ALL_MOUSE_MODES) {
/*
diff --git a/tmux.h b/tmux.h
index 7d5f230..d78e2a7 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1125,6 +1125,11 @@ LIST_HEAD(tty_terms, tty_term);
#define MOUSE_EVENT_CLICK (1 << 3)
#define MOUSE_EVENT_WHEEL (1 << 4)
+/* Mouse modifier key states. */
+#define MOUSE_SHIFT 4
+#define MOUSE_ESCAPE 8
+#define MOUSE_CTRL 16
+
/* Mouse flags. */
#define MOUSE_RESIZE_PANE (1 << 0)
--
1.9.0.rc3
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users