[Toybox] vi 'b' command broken

Oliver Webb aquahobbyist at proton.me
Wed Oct 4 19:51:10 PDT 2023






------- Original Message -------
On Wednesday, October 4th, 2023 at 18:59, Rob Landley <rob at landley.net> wrote:
> On 10/4/23 13:51, enh via Toybox wrote:
> 
> > (since it looks like there are folks actively working on vi atm...)
> > 
> > looks like 'b' goes to the end of the previous word, rather than
> > the beginning of the current word?
> 
> 
> There's no 'b' but there is a "b" (which is weird because all the vi_mov_param
> are chars so why is that a string) which dispatches to vi_movb() which is
> multiplying count0 by count1. What ARE count0 and count1? 

>From my looking over of the vi.c, count0 and count1 specify arguments to commands
("15G" gives 15 as count0 in vi_go()). As for the multiplying, all my debug printf's
show count1 being set to 1 so I have no idea why it's multiplying.

> The only caller of
> vi_movs[] is run_vi_command() which is passing in TT.count0 and TT.count1 as
> global variables, which are only ever used locally in vi_run_command(), and
> which are initialized to 0 at the start of the function and then that's assigned
> over without ever being used by TT.count0 = val 11 lines later (assuming
> strtol() didn't use the value, we didn't call any other functions)...
> 
> And I'm backing slowly away from this Thing That Needs Focus To Clean Up. Gotta
> close the open cans of worms first, thanks...

I took a crack at this once I saw Elliot's email thinking this would be a trivial fix without rewriting
the "b" command. But after looking over vi_movb(), I can barley tell why half the code is there 
(There is a for loop only explained by a comment "find first". 
When I comment the entire for loop out the I can use the "b" command as normal...)

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net

- Oliver Webb <aquahobbyist at proton.me>


More information about the Toybox mailing list