aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-11 20:01:38 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-11 20:13:19 +0100
commit8bf82ddbfb84b5ca32824a466380dae4df4ff31a (patch)
tree9d2491357fedde75d2668b45e2f82a8959ed1f79 /src
parent5572c468582f9f4796b274e98c738dee51c30e90 (diff)
downloadchawan-8bf82ddbfb84b5ca32824a466380dae4df4ff31a.tar.gz
client: fix thumb button confusion
the 0x40 bitmask implies one more state than the 0 bitmask, since state 3 with 0 is unused[0]. so we must add 7, not 6 [0] it's reserved for "move", but movement is indicated differently in the protocol we use so unused
Diffstat (limited to 'src')
-rw-r--r--src/local/client.nim36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index 18ac2519..f8e1433d 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -213,17 +213,17 @@ type
mimShift = "shift", mimCtrl = "ctrl", mimMeta = "meta"
MouseInputButton = enum
- mibLeft = (0, "left")
- mibMiddle = (1, "middle")
- mibRight = (2, "right")
- mibWheelUp = (3, "wheelUp")
- mibWheelDown = (4, "wheelDown")
- mibWheelLeft = (5, "wheelLeft")
- mibWheelRight = (6, "wheelRight")
- mibButton8 = (7, "button8")
- mibButton9 = (8, "button9")
- mibButton10 = (9, "button10")
- mibButton11 = (10, "button11")
+ mibLeft = (1, "left")
+ mibMiddle = (2, "middle")
+ mibRight = (3, "right")
+ mibWheelUp = (4, "wheelUp")
+ mibWheelDown = (5, "wheelDown")
+ mibWheelLeft = (6, "wheelLeft")
+ mibWheelRight = (7, "wheelRight")
+ mibThumbInner = (8, "thumbInner")
+ mibThumbTip = (9, "thumbTip")
+ mibButton10 = (10, "button10")
+ mibButton11 = (11, "button11")
MouseInput = object
t: MouseInputType
@@ -267,11 +267,11 @@ proc parseMouseInput(client: Client): Opt[MouseInput] =
var t = if c == 'M': mitPress else: mitRelease
if (btn and 32) != 0:
t = mitMove
- var button = btn and 3
+ var button = (btn and 3) + 1
if (btn and 64) != 0:
button += 3
if (btn and 128) != 0:
- button += 6
+ button += 7
if button notin int(MouseInputButton.low)..int(MouseInputButton.high):
return err()
ok(MouseInput(
@@ -342,7 +342,7 @@ proc handleCommandInput(client: Client, c: char): EmptyPromise =
client.pressed = (-1, -1)
else: discard
of mibMiddle:
- if input.t == mitPress:
+ if input.t == mitRelease: # release, to emulate w3m
client.pager.discardBuffer()
of mibWheelUp:
if input.t == mitPress:
@@ -356,12 +356,12 @@ proc handleCommandInput(client: Client, c: char): EmptyPromise =
of mibWheelRight:
if input.t == mitPress:
container.scrollRight(5)
- of mibButton8:
- if input.t == mitPress:
- discard client.pager.nextBuffer()
- of mibButton9:
+ of mibThumbInner:
if input.t == mitPress:
discard client.pager.prevBuffer()
+ of mibThumbTip:
+ if input.t == mitPress:
+ discard client.pager.nextBuffer()
else: discard
client.pager.inputBuffer = ""
elif "\e[<".startsWith(client.pager.inputBuffer):