« get me outta code hell

Mouse drag support; pass detailed data to handlers - tui-lib - Pure Node.js library for making visual command-line programs (ala vim, ncdu)
about summary refs log tree commit diff
path: root/util/telchars.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2019-07-18 22:46:00 -0300
committerFlorrie <towerofnix@gmail.com>2019-07-18 22:46:00 -0300
commit7bf0f9016cd195be20e76fbed8637b3b00a46725 (patch)
tree6ff7e2f829df0386120cb53cf3b7c37f4b748366 /util/telchars.js
parent9210cbf5986f4e7b796d39fe36d81aeab1992ae3 (diff)
Mouse drag support; pass detailed data to handlers
...for mouse events. Contains cursor position, modifier keys pressed,
etc.
Diffstat (limited to 'util/telchars.js')
-rw-r--r--util/telchars.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/telchars.js b/util/telchars.js
index b099f65..68294bf 100644
--- a/util/telchars.js
+++ b/util/telchars.js
@@ -39,11 +39,15 @@ const telchars = {
       if (num & 1) button = 'scroll-down'
       else button = 'scroll-up'
     } else {
+      const drag = num & 32
       const bits = num & 3
       if (bits === 0) button = 'left'
       else if (bits === 1) button = 'middle'
       else if (bits === 2) button = 'right'
       else if (bits === 3) button = 'release'
+      if (drag) {
+        button = 'drag-' + button
+      }
     }
 
     const shift = !!(num & 4)