aboutsummaryrefslogtreecommitdiff
path: root/termkey.c
diff options
context:
space:
mode:
authorPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 00:19:10 +0100
committerPaul LeoNerd Evans <leonerd@leonerd.org.uk>2012-04-12 00:19:10 +0100
commit60b4bfaf72cab1af28c12031b2ffefc0ec7b1fb6 (patch)
tree17ad0a061b8c2e3a01040a806d010058f926157d /termkey.c
parentff99b29b967579d5ce82e752d0f8407233e67df2 (diff)
downloadtermo-60b4bfaf72cab1af28c12031b2ffefc0ec7b1fb6.tar.gz
termo-60b4bfaf72cab1af28c12031b2ffefc0ec7b1fb6.tar.xz
termo-60b4bfaf72cab1af28c12031b2ffefc0ec7b1fb6.zip
Recognise SGR-style mouse encoding
Diffstat (limited to 'termkey.c')
-rw-r--r--termkey.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/termkey.c b/termkey.c
index e3dec33..0f3a28d 100644
--- a/termkey.c
+++ b/termkey.c
@@ -894,6 +894,7 @@ static TermKeyResult peekkey_mouse(TermKey *tk, TermKeyKey *key, size_t *nbytep)
key->code.mouse[0] = CHARAT(0) - 0x20;
key->code.mouse[1] = CHARAT(1) - 0x20;
key->code.mouse[2] = CHARAT(2) - 0x20;
+ key->code.mouse[3] = 0;
key->modifiers = (key->code.mouse[0] & 0x1c) >> 2;
key->code.mouse[0] &= ~0x1c;
@@ -953,6 +954,9 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe
if(button)
*button = btn;
+ if(key->code.mouse[3])
+ *event = TERMKEY_MOUSE_RELEASE;
+
return TERMKEY_RES_KEY;
}