summaryrefslogtreecommitdiff
path: root/sys/src/cmd/acme/scrl.c
diff options
context:
space:
mode:
authorkvik <kvik@a-b.xyz>2020-06-11 15:33:57 +0200
committerkvik <kvik@a-b.xyz>2020-06-11 15:33:57 +0200
commit57362e0c8c3b75cae8f3bc2735ffc6e30e19fe03 (patch)
tree606cc1b5a7d2a0b5cd16185dbcd751b9d82c7ad1 /sys/src/cmd/acme/scrl.c
parentdb6e26d55eb5bdb22ea231642051ff9a1562239b (diff)
acme: implement position-dependent scroll-wheel scrolling
This brings acme scrolling behaviour in line with that of 9front's rio and sam, where the amount scrolled varies with a vertical position of the pointer within the window, similar to how the scrollbar works. At some point it would be good to implement a line-at-a-time scrolling when the Shift key is pressed, as seen in rio. For this to happen the acme keyboard input needs to be rewritten in terms of /dev/kbd instead of relying on keyboard(2) -- that is, the /dev/cons interface.
Diffstat (limited to 'sys/src/cmd/acme/scrl.c')
-rw-r--r--sys/src/cmd/acme/scrl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/cmd/acme/scrl.c b/sys/src/cmd/acme/scrl.c
index 1310bc763..0d4173968 100644
--- a/sys/src/cmd/acme/scrl.c
+++ b/sys/src/cmd/acme/scrl.c
@@ -132,7 +132,7 @@ textscroll(Text *t, int but)
readmouse(mousectl);
continue;
}
- if(but == 1)
+ if(but == 1 || but == 4)
p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
else
p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
@@ -140,7 +140,7 @@ textscroll(Text *t, int but)
textsetorigin(t, p0, TRUE);
oldp0 = p0;
/* debounce */
- if(first){
+ if(first && but < 4){
flushimage(display, 1);
sleep(200);
nbrecv(mousectl->c, &mousectl->Mouse);