9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] acme: Rio-like scrolling
@ 2025-02-04 17:21 Nikita Georgiou
  2025-02-04 18:14 ` hiro
  2025-02-05 20:34 ` ori
  0 siblings, 2 replies; 12+ messages in thread
From: Nikita Georgiou @ 2025-02-04 17:21 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it more
in line with the rest of the 9front environment. It doesn't quite have
parity with Rio scrolling (it doesn't support scrolling one line at a time
while holding shift) but that requires making a change large enough to be
its own patch. This should alleviate one of the (imo) main warts with Acme.
---
diff a787cb853b0885cc5ecd21fafc4076d77ae354ab uncommitted
--- a/acme.c
+++ b/acme.c
@@ -521,14 +521,13 @@
  }
  /* scroll buttons, wheels, etc. */
  if(t->what==Body && w != nil && (m.buttons & (8|16))){
- if(m.buttons & 8)
- but = Kscrolloneup;
- else
- but = Kscrollonedown;
- winlock(w, 'M');
- t->eq0 = ~0;
- texttype(t, but);
- winunlock(w);
+             winlock(w, 'M');
+             t->eq0 = ~0;
+             if(m.buttons & 8)
+                 textscroll(t, 4);
+             else
+                 textscroll(t, 5);
+             winunlock(w);
  goto Continue;
  }
  if(ptinrect(m.xy, t->scrollr)){
--- a/scrl.c
+++ b/scrl.c
@@ -126,9 +126,12 @@
  my = s.max.y;
  if(but == 2){
  y = my;
- p0 = (vlong)t->file->nc*(y-s.min.y)/h;
- if(p0 >= t->q1)
- p0 = textbacknl(t, p0, 2);
+ if(y > s.max.y-2)
+ y = s.max.y-2;
+ if(t->file->nc > 1024*1024)
+ p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
+ else
+ p0 = t->file->nc*(y-s.min.y)/h;
  if(oldp0 != p0)
  textsetorigin(t, p0, FALSE);
  oldp0 = p0;
@@ -135,16 +138,22 @@
  readmouse(mousectl);
  continue;
  }
- if(but == 1)
- p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
- else
- p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
+ if(but == 1 || but == 4){
+ y = max(1, (my-s.min.y)/t->font->height);
+ p0 = textbacknl(t, t->org, y);
+ }else{
+ y = max(my, s.min.y+t->font->height);
+ p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
+ }
  if(oldp0 != p0)
  textsetorigin(t, p0, TRUE);
  oldp0 = p0;
  /* debounce */
  if(first){
- flushimage(display, 1);
+ if(display->bufp > display->buf)
+ flushimage(display, 1);
+ if(but > 3)
+ return;
  sleep(200);
  nbrecv(mousectl->c, &mousectl->Mouse);
  first = FALSE;
@@ -153,4 +162,5 @@
  }while(mouse->buttons & (1<<(but-1)));
  while(mouse->buttons)
  readmouse(mousectl);
-}
+
+}
\ No newline at end of file

[-- Attachment #2: Type: text/html, Size: 2869 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 17:21 [9front] acme: Rio-like scrolling Nikita Georgiou
@ 2025-02-04 18:14 ` hiro
  2025-02-04 21:20   ` qwx
  2025-02-05 20:30   ` ori
  2025-02-05 20:34 ` ori
  1 sibling, 2 replies; 12+ messages in thread
From: hiro @ 2025-02-04 18:14 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 3033 bytes --]

what is special about rio-scrolling?
i know of samscrolling. which to me is mainly summarized by wrapped text
always fucking up the algorithm to near unusability. esp. if you want an
undo for scrolling (scroll down, then scroll up the same exact distance).

what innovation has been brought by acme (my memory of acme is fading)?

"doesn't support scrolling one line at a time while holding shift"
sperg-scrolling is an anti-feature. there is no reason anybody should ever
want this.

On Tue, Feb 4, 2025 at 6:21 PM Nikita Georgiou <nikitageorgiou@gmail.com>
wrote:

> This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it
> more in line with the rest of the 9front environment. It doesn't quite have
> parity with Rio scrolling (it doesn't support scrolling one line at a time
> while holding shift) but that requires making a change large enough to be
> its own patch. This should alleviate one of the (imo) main warts with Acme.
> ---
> diff a787cb853b0885cc5ecd21fafc4076d77ae354ab uncommitted
> --- a/acme.c
> +++ b/acme.c
> @@ -521,14 +521,13 @@
>   }
>   /* scroll buttons, wheels, etc. */
>   if(t->what==Body && w != nil && (m.buttons & (8|16))){
> - if(m.buttons & 8)
> - but = Kscrolloneup;
> - else
> - but = Kscrollonedown;
> - winlock(w, 'M');
> - t->eq0 = ~0;
> - texttype(t, but);
> - winunlock(w);
> +             winlock(w, 'M');
> +             t->eq0 = ~0;
> +             if(m.buttons & 8)
> +                 textscroll(t, 4);
> +             else
> +                 textscroll(t, 5);
> +             winunlock(w);
>   goto Continue;
>   }
>   if(ptinrect(m.xy, t->scrollr)){
> --- a/scrl.c
> +++ b/scrl.c
> @@ -126,9 +126,12 @@
>   my = s.max.y;
>   if(but == 2){
>   y = my;
> - p0 = (vlong)t->file->nc*(y-s.min.y)/h;
> - if(p0 >= t->q1)
> - p0 = textbacknl(t, p0, 2);
> + if(y > s.max.y-2)
> + y = s.max.y-2;
> + if(t->file->nc > 1024*1024)
> + p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
> + else
> + p0 = t->file->nc*(y-s.min.y)/h;
>   if(oldp0 != p0)
>   textsetorigin(t, p0, FALSE);
>   oldp0 = p0;
> @@ -135,16 +138,22 @@
>   readmouse(mousectl);
>   continue;
>   }
> - if(but == 1)
> - p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
> - else
> - p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
> + if(but == 1 || but == 4){
> + y = max(1, (my-s.min.y)/t->font->height);
> + p0 = textbacknl(t, t->org, y);
> + }else{
> + y = max(my, s.min.y+t->font->height);
> + p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
> + }
>   if(oldp0 != p0)
>   textsetorigin(t, p0, TRUE);
>   oldp0 = p0;
>   /* debounce */
>   if(first){
> - flushimage(display, 1);
> + if(display->bufp > display->buf)
> + flushimage(display, 1);
> + if(but > 3)
> + return;
>   sleep(200);
>   nbrecv(mousectl->c, &mousectl->Mouse);
>   first = FALSE;
> @@ -153,4 +162,5 @@
>   }while(mouse->buttons & (1<<(but-1)));
>   while(mouse->buttons)
>   readmouse(mousectl);
> -}
> +
> +}
> \ No newline at end of file
>

[-- Attachment #2: Type: text/html, Size: 3850 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 18:14 ` hiro
@ 2025-02-04 21:20   ` qwx
  2025-02-04 22:00     ` Stanley Lieber
  2025-02-05 20:30   ` ori
  1 sibling, 1 reply; 12+ messages in thread
From: qwx @ 2025-02-04 21:20 UTC (permalink / raw)
  To: 9front

On Tue Feb  4 19:14:53 +0100 2025, 23hiro@gmail.com wrote:

> what is special about rio-scrolling?
> i know of samscrolling. which to me is mainly summarized by wrapped text
> always fucking up the algorithm to near unusability. esp. if you want an
> undo for scrolling (scroll down, then scroll up the same exact distance).
> 
> what innovation has been brought by acme (my memory of acme is fading)?
> 
> "doesn't support scrolling one line at a time while holding shift"
> sperg-scrolling is an anti-feature. there is no reason anybody should ever
> want this.
> 
> On Tue, Feb 4, 2025 at 6:21 PM Nikita Georgiou <nikitageorgiou@gmail.com>
> wrote:
> 
> > This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it
> > more in line with the rest of the 9front environment. It doesn't quite have
> > parity with Rio scrolling (it doesn't support scrolling one line at a time
> > while holding shift) but that requires making a change large enough to be
> > its own patch. This should alleviate one of the (imo) main warts with Acme.

Thanks for sharing this patch, but I don't recall ever hearing of an
acme user complain about its scrolling behavior or it not being like
rio's.  This bringing it more in line with the restart of the 9front
environment is debatable, there is no standard scrolling behavior.
acme, rio and samterm all behave differently, as do mothra, spred, and
so on.  Furthermore, there's more than one mechanism for it besides
the arrow keys, such as page-up/down and clicking the scroll bars.  I
too think scrolling by one line with shift+arrow is an anti-pattern,
and personally, I never end up using the arrow keys for navigation at
all.  I think the other methods are far easier to reach and more
effective.  There are plans for replacing some of the libraries like
libframe with something better and easier to use, and have all of
these programs just use that.  Standardizing behavior across the
entire system in that way makes more sense in my opinion.

As you can see this is all very subjective and opinionated, so I doubt
we will be patching the editors individually any time soon, but the
patch is here in case anyone wants it for their own acme.

Thanks,
qwx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 21:20   ` qwx
@ 2025-02-04 22:00     ` Stanley Lieber
  2025-02-04 22:15       ` qwx
  0 siblings, 1 reply; 12+ messages in thread
From: Stanley Lieber @ 2025-02-04 22:00 UTC (permalink / raw)
  To: 9front



> On Feb 4, 2025, at 4:20 PM, qwx@sciops.net wrote:
> 
> On Tue Feb  4 19:14:53 +0100 2025, 23hiro@gmail.com wrote:
> 
>> what is special about rio-scrolling?
>> i know of samscrolling. which to me is mainly summarized by wrapped text
>> always fucking up the algorithm to near unusability. esp. if you want an
>> undo for scrolling (scroll down, then scroll up the same exact distance).
>> 
>> what innovation has been brought by acme (my memory of acme is fading)?
>> 
>> "doesn't support scrolling one line at a time while holding shift"
>> sperg-scrolling is an anti-feature. there is no reason anybody should ever
>> want this.
>> 
>>> On Tue, Feb 4, 2025 at 6:21 PM Nikita Georgiou <nikitageorgiou@gmail.com>
>>> wrote:
>>> 
>>> This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it
>>> more in line with the rest of the 9front environment. It doesn't quite have
>>> parity with Rio scrolling (it doesn't support scrolling one line at a time
>>> while holding shift) but that requires making a change large enough to be
>>> its own patch. This should alleviate one of the (imo) main warts with Acme.
> 
> Thanks for sharing this patch, but I don't recall ever hearing of an
> acme user complain about its scrolling behavior or it not being like
> rio's.  This bringing it more in line with the restart of the 9front
> environment is debatable, there is no standard scrolling behavior.
> acme, rio and samterm all behave differently, as do mothra, spred, and
> so on.  Furthermore, there's more than one mechanism for it besides
> the arrow keys, such as page-up/down and clicking the scroll bars.  I
> too think scrolling by one line with shift+arrow is an anti-pattern,
> and personally, I never end up using the arrow keys for navigation at
> all.  I think the other methods are far easier to reach and more
> effective.  There are plans for replacing some of the libraries like
> libframe with something better and easier to use, and have all of
> these programs just use that.  Standardizing behavior across the
> entire system in that way makes more sense in my opinion.
> 
> As you can see this is all very subjective and opinionated, so I doubt
> we will be patching the editors individually any time soon, but the
> patch is here in case anyone wants it for their own acme.
> 
> Thanks,
> qwx

i believe “galaxy brain scrolling” refers to the behavior in rio, samterm, mothra, the netsurf port, etc., where scrolling with a mouse scrollwheel acts roughly the same as clicking in the scrollbar: the scrolling increment increases the further down the pointer is while you’re scrolling. in the case of the mouse scrollwheel, this lets you dynamically vary the increment very fluidly by feel without having to move your eyes away from whatever it is you’re looking at in the active window.

it never got added to acme.

shift+up/down to scroll “one line” is only in our rio, as far as i know. i found this useful for precision control of our native irc clients. i also would have found it useful in mothra, but it never got added there or anywhere else.

in both cases, it was me who asked for the changes and somebody else who actually implemented them. adding these behaviors to other programs has been on various public todo lists for years, which is why the topic periodically resurfaces when someone is looking for something to contribute.

sl



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 22:00     ` Stanley Lieber
@ 2025-02-04 22:15       ` qwx
  2025-02-04 22:40         ` Stanley Lieber
  0 siblings, 1 reply; 12+ messages in thread
From: qwx @ 2025-02-04 22:15 UTC (permalink / raw)
  To: 9front

On Tue Feb  4 23:04:55 +0100 2025, sl@stanleylieber.com wrote:
> i believe “galaxy brain scrolling” refers to the behavior in rio, samterm, mothra, the netsurf port, etc., where scrolling with a mouse scrollwheel acts roughly the same as clicking in the scrollbar: the scrolling increment increases the further down the pointer is while you’re scrolling. in the case of the mouse scrollwheel, this lets you dynamically vary the increment very fluidly by feel without having to move your eyes away from whatever it is you’re looking at in the active window.
> 
> it never got added to acme.
> 
> shift+up/down to scroll “one line” is only in our rio, as far as i know. i found this useful for precision control of our native irc clients. i also would have found it useful in mothra, but it never got added there or anywhere else.
> 
> in both cases, it was me who asked for the changes and somebody else who actually implemented them. adding these behaviors to other programs has been on various public todo lists for years, which is why the topic periodically resurfaces when someone is looking for something to contribute.
> 
> sl

You're right, I misremembered what this was refering to and got
confused, especially because I only use trackpoints and never think of
the scroll wheel.  Thanks for re-explaining it, we should add this to
the manpage at least.

Nevertheless, even discussing this very thing on irc, there are
conflicting opinions, so I'm not sure about this.  It would be useful
for precise use cases to be given, as you have, and for others to
speak up on their usage pattern.

Thanks,
qwx


> > On Feb 4, 2025, at 4:20 PM, qwx@sciops.net wrote:
> > 
> > On Tue Feb  4 19:14:53 +0100 2025, 23hiro@gmail.com wrote:
> > 
> >> what is special about rio-scrolling?
> >> i know of samscrolling. which to me is mainly summarized by wrapped text
> >> always fucking up the algorithm to near unusability. esp. if you want an
> >> undo for scrolling (scroll down, then scroll up the same exact distance).
> >> 
> >> what innovation has been brought by acme (my memory of acme is fading)?
> >> 
> >> "doesn't support scrolling one line at a time while holding shift"
> >> sperg-scrolling is an anti-feature. there is no reason anybody should ever
> >> want this.
> >> 
> >>> On Tue, Feb 4, 2025 at 6:21 PM Nikita Georgiou <nikitageorgiou@gmail.com>
> >>> wrote:
> >>> 
> >>> This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it
> >>> more in line with the rest of the 9front environment. It doesn't quite have
> >>> parity with Rio scrolling (it doesn't support scrolling one line at a time
> >>> while holding shift) but that requires making a change large enough to be
> >>> its own patch. This should alleviate one of the (imo) main warts with Acme.
> > 
> > Thanks for sharing this patch, but I don't recall ever hearing of an
> > acme user complain about its scrolling behavior or it not being like
> > rio's.  This bringing it more in line with the restart of the 9front
> > environment is debatable, there is no standard scrolling behavior.
> > acme, rio and samterm all behave differently, as do mothra, spred, and
> > so on.  Furthermore, there's more than one mechanism for it besides
> > the arrow keys, such as page-up/down and clicking the scroll bars.  I
> > too think scrolling by one line with shift+arrow is an anti-pattern,
> > and personally, I never end up using the arrow keys for navigation at
> > all.  I think the other methods are far easier to reach and more
> > effective.  There are plans for replacing some of the libraries like
> > libframe with something better and easier to use, and have all of
> > these programs just use that.  Standardizing behavior across the
> > entire system in that way makes more sense in my opinion.
> > 
> > As you can see this is all very subjective and opinionated, so I doubt
> > we will be patching the editors individually any time soon, but the
> > patch is here in case anyone wants it for their own acme.
> > 
> > Thanks,
> > qwx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 22:15       ` qwx
@ 2025-02-04 22:40         ` Stanley Lieber
  2025-02-05  0:51           ` umbraticus
  0 siblings, 1 reply; 12+ messages in thread
From: Stanley Lieber @ 2025-02-04 22:40 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 3009 bytes --]



> On Feb 4, 2025, at 5:20 PM, qwx@sciops.net wrote:
> 
> On Tue Feb  4 23:04:55 +0100 2025, sl@stanleylieber.com wrote:
>> i believe “galaxy brain scrolling” refers to the behavior in rio, samterm, mothra, the netsurf port, etc., where scrolling with a mouse scrollwheel acts roughly the same as clicking in the scrollbar: the scrolling increment increases the further down the pointer is while you’re scrolling. in the case of the mouse scrollwheel, this lets you dynamically vary the increment very fluidly by feel without having to move your eyes away from whatever it is you’re looking at in the active window.
>> 
>> it never got added to acme.
>> 
>> shift+up/down to scroll “one line” is only in our rio, as far as i know. i found this useful for precision control of our native irc clients. i also would have found it useful in mothra, but it never got added there or anywhere else.
>> 
>> in both cases, it was me who asked for the changes and somebody else who actually implemented them. adding these behaviors to other programs has been on various public todo lists for years, which is why the topic periodically resurfaces when someone is looking for something to contribute.
>> 
>> sl
> 
> You're right, I misremembered what this was refering to and got
> confused, especially because I only use trackpoints and never think of
> the scroll wheel.  Thanks for re-explaining it, we should add this to
> the manpage at least.
> 
> Nevertheless, even discussing this very thing on irc, there are
> conflicting opinions, so I'm not sure about this.  It would be useful
> for precise use cases to be given, as you have, and for others to
> speak up on their usage pattern.
> 
> Thanks,
> qwx

i never touched the man page, but it is at least all documented here:

https://fqa.9front.org/fqa8.html#8.2.4

i’m not aware of anyone who has ever been happy with how pgup/pgdn scrolling works, especially in samterm. the two newer techniques we’ve been discussing made it a lot easier for me to exercise finer-grained control over what happened inside the active window whenever i needed to scroll. mainly because i got sick of having to cycle my eyes in an ieee signal acquisition algorithm search pattern just to find my place again because no two invocations of a scroll button ever resulted in a consistent onscreen change. obviously, “galaxy brain” scrolling isn’t helpful if you’re driving a trackpoint, but it was something of a revelation with a mouse, because (at least for me) it expanded the ability to mouse purely by feel. you can just start scrolling, and then move up or down to smoothly adjust the increment, without having to micromanage the pointer.

on the other hand, these two changes were credited with driving eekee away from plan 9, so at least one person who was actually trying to use them on a daily basis held a strong opinion they were shit.

in the meantime, scrolling up and down pretty much sucks.

sl



[-- Attachment #2: Type: text/html, Size: 4126 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 22:40         ` Stanley Lieber
@ 2025-02-05  0:51           ` umbraticus
  0 siblings, 0 replies; 12+ messages in thread
From: umbraticus @ 2025-02-05  0:51 UTC (permalink / raw)
  To: 9front

There is also Kscrolleonedown and mousescrollsize() which was perhaps 
intended to assuage eekee's ire?? Maybe a better pattern than having to 
have shift + scroll would be: if the env var exists, scroll by it, otherwise 
galaxy scroll. 
 
umbraticus 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 18:14 ` hiro
  2025-02-04 21:20   ` qwx
@ 2025-02-05 20:30   ` ori
  1 sibling, 0 replies; 12+ messages in thread
From: ori @ 2025-02-05 20:30 UTC (permalink / raw)
  To: 9front

Quoth hiro <23hiro@gmail.com>:
> 
> what innovation has been brought by acme (my memory of acme is fading)?

I think you misunderstood. this fixes acme so that it behaves like rio.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-04 17:21 [9front] acme: Rio-like scrolling Nikita Georgiou
  2025-02-04 18:14 ` hiro
@ 2025-02-05 20:34 ` ori
  2025-02-11  0:03   ` Nikita Georgiou
  1 sibling, 1 reply; 12+ messages in thread
From: ori @ 2025-02-05 20:34 UTC (permalink / raw)
  To: 9front

unfortunately, the gmail web ui garbles patches (replacing tabs
with spaces).

Quoth Nikita Georgiou <nikitageorgiou@gmail.com>:
> This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it more
> in line with the rest of the 9front environment. It doesn't quite have
> parity with Rio scrolling (it doesn't support scrolling one line at a time
> while holding shift) but that requires making a change large enough to be
> its own patch. This should alleviate one of the (imo) main warts with Acme.
> ---
> diff a787cb853b0885cc5ecd21fafc4076d77ae354ab uncommitted
> --- a/acme.c
> +++ b/acme.c
> @@ -521,14 +521,13 @@
>   }
>   /* scroll buttons, wheels, etc. */
>   if(t->what==Body && w != nil && (m.buttons & (8|16))){
> - if(m.buttons & 8)
> - but = Kscrolloneup;
> - else
> - but = Kscrollonedown;
> - winlock(w, 'M');
> - t->eq0 = ~0;
> - texttype(t, but);
> - winunlock(w);
> +             winlock(w, 'M');
> +             t->eq0 = ~0;
> +             if(m.buttons & 8)
> +                 textscroll(t, 4);
> +             else
> +                 textscroll(t, 5);
> +             winunlock(w);
>   goto Continue;
>   }
>   if(ptinrect(m.xy, t->scrollr)){
> --- a/scrl.c
> +++ b/scrl.c
> @@ -126,9 +126,12 @@
>   my = s.max.y;
>   if(but == 2){
>   y = my;
> - p0 = (vlong)t->file->nc*(y-s.min.y)/h;
> - if(p0 >= t->q1)
> - p0 = textbacknl(t, p0, 2);
> + if(y > s.max.y-2)
> + y = s.max.y-2;
> + if(t->file->nc > 1024*1024)
> + p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
> + else
> + p0 = t->file->nc*(y-s.min.y)/h;
>   if(oldp0 != p0)
>   textsetorigin(t, p0, FALSE);
>   oldp0 = p0;
> @@ -135,16 +138,22 @@
>   readmouse(mousectl);
>   continue;
>   }
> - if(but == 1)
> - p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
> - else
> - p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
> + if(but == 1 || but == 4){
> + y = max(1, (my-s.min.y)/t->font->height);
> + p0 = textbacknl(t, t->org, y);
> + }else{
> + y = max(my, s.min.y+t->font->height);
> + p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
> + }
>   if(oldp0 != p0)
>   textsetorigin(t, p0, TRUE);
>   oldp0 = p0;
>   /* debounce */
>   if(first){
> - flushimage(display, 1);
> + if(display->bufp > display->buf)
> + flushimage(display, 1);
> + if(but > 3)
> + return;
>   sleep(200);
>   nbrecv(mousectl->c, &mousectl->Mouse);
>   first = FALSE;
> @@ -153,4 +162,5 @@
>   }while(mouse->buttons & (1<<(but-1)));
>   while(mouse->buttons)
>   readmouse(mousectl);
> -}
> +
> +}
> \ No newline at end of file
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-05 20:34 ` ori
@ 2025-02-11  0:03   ` Nikita Georgiou
  2025-02-11 18:25     ` ori
  0 siblings, 1 reply; 12+ messages in thread
From: Nikita Georgiou @ 2025-02-11  0:03 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 148 bytes --]

Hey, here’s the patch to add Rio-like scroll wheel behavior to Acme hopefully without spaces this time. I’ve also attached it as an attachment

[-- Attachment #2: acmescroll.patch --]
[-- Type: application/octet-stream, Size: 2084 bytes --]

From: glenda <glenda@cirno>
Date: Mon, 10 Feb 2025 23:57:25 +0000
Subject: [PATCH] Add Rio-like scrolling to acme

---
diff 1d8c675b50d25d333cf87446e4f03ff801a9e18c 58d6d1d668eb96ae947281059a2967f077dee236
--- a/acme.c
+++ b/acme.c
@@ -521,14 +521,13 @@
 			}
 			/* scroll buttons, wheels, etc. */
 			if(t->what==Body && w != nil && (m.buttons & (8|16))){
-				if(m.buttons & 8)
-					but = Kscrolloneup;
-				else
-					but = Kscrollonedown;
-				winlock(w, 'M');
-				t->eq0 = ~0;
-				texttype(t, but);
-				winunlock(w);
+            	winlock(w, 'M');
+            	t->eq0 = ~0;
+            	if(m.buttons & 8)
+                	textscroll(t, 4);
+            	else
+                	textscroll(t, 5);
+            	winunlock(w);
 				goto Continue;
 			}
 			if(ptinrect(m.xy, t->scrollr)){
--- a/scrl.c
+++ b/scrl.c
@@ -126,9 +126,12 @@
 			my = s.max.y;
 		if(but == 2){
 			y = my;
-			p0 = (vlong)t->file->nc*(y-s.min.y)/h;
-			if(p0 >= t->q1)
-				p0 = textbacknl(t, p0, 2);
+			if(y > s.max.y-2)
+				y = s.max.y-2;
+			if(t->file->nc > 1024*1024)
+				p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
+			else
+				p0 = t->file->nc*(y-s.min.y)/h;
 			if(oldp0 != p0)
 				textsetorigin(t, p0, FALSE);
 			oldp0 = p0;
@@ -135,16 +138,22 @@
 			readmouse(mousectl);
 			continue;
 		}
-		if(but == 1)
-			p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
-		else
-			p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
+		if(but == 1 || but == 4){
+			y = max(1, (my-s.min.y)/t->font->height);
+			p0 = textbacknl(t, t->org, y);
+		}else{
+			y = max(my, s.min.y+t->font->height);
+			p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
+		}
 		if(oldp0 != p0)
 			textsetorigin(t, p0, TRUE);
 		oldp0 = p0;
 		/* debounce */
 		if(first){
-			flushimage(display, 1);
+			if(display->bufp > display->buf)
+				flushimage(display, 1);
+			if(but > 3)
+				return;
 			sleep(200);
 			nbrecv(mousectl->c, &mousectl->Mouse);
 			first = FALSE;
@@ -153,4 +162,5 @@
 	}while(mouse->buttons & (1<<(but-1)));
 	while(mouse->buttons)
 		readmouse(mousectl);
-}
+
+}
\ No newline at end of file

[-- Attachment #3: Type: text/plain, Size: 4776 bytes --]



---
diff 1d8c675b50d25d333cf87446e4f03ff801a9e18c 58d6d1d668eb96ae947281059a2967f077dee236
--- a/acme.c
+++ b/acme.c
@@ -521,14 +521,13 @@
 			}
 			/* scroll buttons, wheels, etc. */
 			if(t->what==Body && w != nil && (m.buttons & (8|16))){
-				if(m.buttons & 8)
-					but = Kscrolloneup;
-				else
-					but = Kscrollonedown;
-				winlock(w, 'M');
-				t->eq0 = ~0;
-				texttype(t, but);
-				winunlock(w);
+            	winlock(w, 'M');
+            	t->eq0 = ~0;
+            	if(m.buttons & 8)
+                	textscroll(t, 4);
+            	else
+                	textscroll(t, 5);
+            	winunlock(w);
 				goto Continue;
 			}
 			if(ptinrect(m.xy, t->scrollr)){
--- a/scrl.c
+++ b/scrl.c
@@ -126,9 +126,12 @@
 			my = s.max.y;
 		if(but == 2){
 			y = my;
-			p0 = (vlong)t->file->nc*(y-s.min.y)/h;
-			if(p0 >= t->q1)
-				p0 = textbacknl(t, p0, 2);
+			if(y > s.max.y-2)
+				y = s.max.y-2;
+			if(t->file->nc > 1024*1024)
+				p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
+			else
+				p0 = t->file->nc*(y-s.min.y)/h;
 			if(oldp0 != p0)
 				textsetorigin(t, p0, FALSE);
 			oldp0 = p0;
@@ -135,16 +138,22 @@
 			readmouse(mousectl);
 			continue;
 		}
-		if(but == 1)
-			p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
-		else
-			p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
+		if(but == 1 || but == 4){
+			y = max(1, (my-s.min.y)/t->font->height);
+			p0 = textbacknl(t, t->org, y);
+		}else{
+			y = max(my, s.min.y+t->font->height);
+			p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
+		}
 		if(oldp0 != p0)
 			textsetorigin(t, p0, TRUE);
 		oldp0 = p0;
 		/* debounce */
 		if(first){
-			flushimage(display, 1);
+			if(display->bufp > display->buf)
+				flushimage(display, 1);
+			if(but > 3)
+				return;
 			sleep(200);
 			nbrecv(mousectl->c, &mousectl->Mouse);
 			first = FALSE;
@@ -153,4 +162,5 @@
 	}while(mouse->buttons & (1<<(but-1)));
 	while(mouse->buttons)
 		readmouse(mousectl);
-}
+
+}
\ No newline at end of file

> On Feb 5, 2025, at 3:34 PM, ori@eigenstate.org wrote:
> 
> unfortunately, the gmail web ui garbles patches (replacing tabs
> with spaces).
> 
> Quoth Nikita Georgiou <nikitageorgiou@gmail.com>:
>> This patch adds Rio-like "galaxy brain" scrolling to Acme, bringing it more
>> in line with the rest of the 9front environment. It doesn't quite have
>> parity with Rio scrolling (it doesn't support scrolling one line at a time
>> while holding shift) but that requires making a change large enough to be
>> its own patch. This should alleviate one of the (imo) main warts with Acme.
>> ---
>> diff a787cb853b0885cc5ecd21fafc4076d77ae354ab uncommitted
>> --- a/acme.c
>> +++ b/acme.c
>> @@ -521,14 +521,13 @@
>>  }
>>  /* scroll buttons, wheels, etc. */
>>  if(t->what==Body && w != nil && (m.buttons & (8|16))){
>> - if(m.buttons & 8)
>> - but = Kscrolloneup;
>> - else
>> - but = Kscrollonedown;
>> - winlock(w, 'M');
>> - t->eq0 = ~0;
>> - texttype(t, but);
>> - winunlock(w);
>> +             winlock(w, 'M');
>> +             t->eq0 = ~0;
>> +             if(m.buttons & 8)
>> +                 textscroll(t, 4);
>> +             else
>> +                 textscroll(t, 5);
>> +             winunlock(w);
>>  goto Continue;
>>  }
>>  if(ptinrect(m.xy, t->scrollr)){
>> --- a/scrl.c
>> +++ b/scrl.c
>> @@ -126,9 +126,12 @@
>>  my = s.max.y;
>>  if(but == 2){
>>  y = my;
>> - p0 = (vlong)t->file->nc*(y-s.min.y)/h;
>> - if(p0 >= t->q1)
>> - p0 = textbacknl(t, p0, 2);
>> + if(y > s.max.y-2)
>> + y = s.max.y-2;
>> + if(t->file->nc > 1024*1024)
>> + p0 = ((t->file->nc>>10)*(y-s.min.y)/h)<<10;
>> + else
>> + p0 = t->file->nc*(y-s.min.y)/h;
>>  if(oldp0 != p0)
>>  textsetorigin(t, p0, FALSE);
>>  oldp0 = p0;
>> @@ -135,16 +138,22 @@
>>  readmouse(mousectl);
>>  continue;
>>  }
>> - if(but == 1)
>> - p0 = textbacknl(t, t->org, (my-s.min.y)/t->font->height);
>> - else
>> - p0 = t->org+frcharofpt(t, Pt(s.max.x, my));
>> + if(but == 1 || but == 4){
>> + y = max(1, (my-s.min.y)/t->font->height);
>> + p0 = textbacknl(t, t->org, y);
>> + }else{
>> + y = max(my, s.min.y+t->font->height);
>> + p0 = t->org+frcharofpt(t, Pt(s.max.x, y));
>> + }
>>  if(oldp0 != p0)
>>  textsetorigin(t, p0, TRUE);
>>  oldp0 = p0;
>>  /* debounce */
>>  if(first){
>> - flushimage(display, 1);
>> + if(display->bufp > display->buf)
>> + flushimage(display, 1);
>> + if(but > 3)
>> + return;
>>  sleep(200);
>>  nbrecv(mousectl->c, &mousectl->Mouse);
>>  first = FALSE;
>> @@ -153,4 +162,5 @@
>>  }while(mouse->buttons & (1<<(but-1)));
>>  while(mouse->buttons)
>>  readmouse(mousectl);
>> -}
>> +
>> +}
>> \ No newline at end of file
>> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-11  0:03   ` Nikita Georgiou
@ 2025-02-11 18:25     ` ori
  2025-02-11 18:29       ` ori
  0 siblings, 1 reply; 12+ messages in thread
From: ori @ 2025-02-11 18:25 UTC (permalink / raw)
  To: 9front

it looks like this wasn't generated against the 9front
repo (which, sure, I guess that's fine)

Quoth Nikita Georgiou <nikitageorgiou@gmail.com>:
> /mail/fs/9Front/5635/2/body.patch

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9front] acme: Rio-like scrolling
  2025-02-11 18:25     ` ori
@ 2025-02-11 18:29       ` ori
  0 siblings, 0 replies; 12+ messages in thread
From: ori @ 2025-02-11 18:29 UTC (permalink / raw)
  To: 9front

Quoth ori@eigenstate.org:
> it looks like this wasn't generated against the 9front
> repo (which, sure, I guess that's fine)
> 
> Quoth Nikita Georgiou <nikitageorgiou@gmail.com>:
> > /mail/fs/9Front/5635/2/body.patch

And, testing it out, scrolling with the mouse over the
scrollbar does nothing; also, clicking on the scrollbar
doesn't match scrolling with the scroll wheel.

I don't thik this patch is quite right yet.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-02-11 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-04 17:21 [9front] acme: Rio-like scrolling Nikita Georgiou
2025-02-04 18:14 ` hiro
2025-02-04 21:20   ` qwx
2025-02-04 22:00     ` Stanley Lieber
2025-02-04 22:15       ` qwx
2025-02-04 22:40         ` Stanley Lieber
2025-02-05  0:51           ` umbraticus
2025-02-05 20:30   ` ori
2025-02-05 20:34 ` ori
2025-02-11  0:03   ` Nikita Georgiou
2025-02-11 18:25     ` ori
2025-02-11 18:29       ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).