[Toybox] [PATCH] more.c: More stuff, down cursor key scrolls down. Also stuff about less

Oliver Webb aquahobbyist at proton.me
Wed Mar 20 09:56:41 PDT 2024


On Wednesday, March 20th, 2024 at 11:39, Rob Landley <rob at landley.net> wrote: 
> More never had the ability to go backwards, less did. Different command.

>From the more help text you get when you press "h":

b or ctrl-B             Skip backwards k screenfuls of text [1]

...

> > Looking at the other keybindings GNU more provides which I can implement, There's "=" (prints current
> > line number) ":f" (print filename and line), as well as being able to use the down arrow to go down
> > (with the added side effect of any escape key doing so too, not the end of the world, especially
> > since we can't scroll up) That are Implemented them in the attached patch.
> 
> Again, more and less are not the same command.

No, all of that is more behavior that you can use in more. Try it.
 
> > There is also a testing problem. vi.c doesn't do TEST_HOST because it needs a -s option
> > to pass in scripts to test with.
> 
> Which is an issue I need to figure out how to address. What does a test that
> only toybox passes actually prove? (That it hasn't changed since we last
> looked at it?)

There is vi -c which preforms a ex command which we could implement
  
> I have been planning one all along, yes. The crunch_str() stuff I did was a
> first pass at general line handling stuff that could be used by less and by
> shell line editing and by vi and so on, but people wrote a vi that does not and
> never will share code with the rest of those so that's off the table
> permanently.

My experience is in vi.c which is why I mentioned using code from it. I haven't read
through top or hexedit

> > But I have to ask the question "If it's so easy, why isn't it in toybox yet?" Is it just because
> > other TODO items taking up time, or is it because it's harder to implement than it seems.
> 
> Because I care about edge cases like ansi escapes and utf8 fontmetrics and
> resizing the screen partway through displaying, because I haven't got test suite
> infrastructure that can emulate the other half of a PTY yet without which
> testing has to be manual, because I wanted multiple things to share
> infrastructure (including potentially stuff like "fold")...

So it's harder to implement than it seems, thank you.

-   Oliver Webb <aquahobbyist at proton.me>



More information about the Toybox mailing list