From 4fcfdbaff38ffe69fd478272f6f1f41714de0b06 Mon Sep 17 00:00:00 2001 From: Dan Kaplun <dan@beardtree.com> Date: Sun, 20 Apr 2014 23:31:01 -0500 Subject: [PATCH] Fixes scroll wheel support with modifiers for GNOME Terminal --- lib/program.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/program.js b/lib/program.js index 17a0b53..ae9aa9b 100644 --- a/lib/program.js +++ b/lib/program.js @@ -401,18 +401,15 @@ Program.prototype._bindMouse = function(s) { if (this.zero) key.x--, key.y--; - mod = b >> 3; - key.shift = mod & 4; - key.meta = mod & 8; - key.ctrl = mod & 16; + mod = b >> 2; + key.shift = !!(mod & 1); + key.meta = !!((mod >> 1) & 1); + key.ctrl = !!((mod >> 2) & 1); b -= 32; - if (b === 64) { - key.action = 'wheelup'; - key.button = 'middle'; - } else if (b === 65) { - key.action = 'wheeldown'; + if ((b >> 6) & 1) { + key.action = b & 1 ? 'wheeldown' : 'wheelup'; key.button = 'middle'; } else if (b === 3) { // Could also be a movement.