aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-11 13:24:11 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-11 13:24:11 +0100
commit76fb59b1f1e02632bdaaf337bb7c882b4d5e9b69 (patch)
tree986a9b436d15365533205760d0514138aa9a77f2
parentdbd5052d8f704d46d3664dc4aa8fb79dd2cea664 (diff)
downloadchawan-76fb59b1f1e02632bdaaf337bb7c882b4d5e9b69.tar.gz
client: bind middle button to discardBuffer, use button5/6 as scroll
middle button to close is from w3m btn5/6 is normally a horizontal scroll wheel, so scrollLeft/Right makes more sense than prev/next
-rw-r--r--src/local/client.nim17
-rw-r--r--src/local/pager.nim2
2 files changed, 14 insertions, 5 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index c55d6ba6..18ac2519 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -218,8 +218,8 @@ type
mibRight = (2, "right")
mibWheelUp = (3, "wheelUp")
mibWheelDown = (4, "wheelDown")
- mibButton6 = (5, "button6")
- mibButton7 = (6, "button7")
+ mibWheelLeft = (5, "wheelLeft")
+ mibWheelRight = (6, "wheelRight")
mibButton8 = (7, "button8")
mibButton9 = (8, "button9")
mibButton10 = (9, "button10")
@@ -341,16 +341,25 @@ proc handleCommandInput(client: Client, c: char): EmptyPromise =
container.scrollDown(-diff[1])
client.pressed = (-1, -1)
else: discard
+ of mibMiddle:
+ if input.t == mitPress:
+ client.pager.discardBuffer()
of mibWheelUp:
if input.t == mitPress:
container.scrollUp(5)
of mibWheelDown:
if input.t == mitPress:
container.scrollDown(5)
- of mibButton6, mibButton8:
+ of mibWheelLeft:
+ if input.t == mitPress:
+ container.scrollLeft(5)
+ of mibWheelRight:
+ if input.t == mitPress:
+ container.scrollRight(5)
+ of mibButton8:
if input.t == mitPress:
discard client.pager.nextBuffer()
- of mibButton7, mibButton9:
+ of mibButton9:
if input.t == mitPress:
discard client.pager.prevBuffer()
else: discard
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 56ecd608..a9d06567 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -586,7 +586,7 @@ proc deleteContainer(pager: Pager, container: Container) =
pager.unreg.add((container.process, container.iface.stream))
pager.forkserver.removeChild(container.process)
-proc discardBuffer(pager: Pager, container = none(Container)) {.jsfunc.} =
+proc discardBuffer*(pager: Pager, container = none(Container)) {.jsfunc.} =
let c = container.get(pager.container)
if c == nil or c.parent == nil and c.children.len == 0:
pager.alert("Cannot discard last buffer!")