[Toybox] [PATCH] vi.c: line ranges, fixed line gotos, CTRL-D, etc

Oliver Webb aquahobbyist at proton.me
Sat Sep 30 21:54:59 PDT 2023


Heya, I have been working a few days on vi.c and have managed to
add a few things. I have a barely-working version of the "g" command
which I have ultimately decided to omit from this patch.

First thing I added was line ranges, the ability to specify
stuff like "10,45d" and have it delete lines 10-45, and also "%"
so you can do stuff like "%d" (and "%s" if I can get that working) 
It only supports plain numbers and doesn't do anything fancy like "+NUMBER" yet.
To get line ranges to work properly, The page has to be re-drawn or else the frame 
breaks (At least while deleting lines, the only thing I can do with these features as of now)

Also, after some testing I realized that the line gotos that I
implemented didn't work in some circumstances, such as at the
top or bottom of a file and/or after moving around in a file using
the cursor keys. I don't know why it does this... my code called
vi_go() and after some testing, calls it in the exact same
way that the "G" command does. I fixed this by making all line goto's run the 
"G" command and let that do whatever it does to prevent that.

I have added in the support for "Go down half a page" CTRL-D, 
and added in the CTL macro after
<enh at google.com> mentioned it. and replaced "27" with "\e"

- Oliver Webb <aquahobbyist at proton.me>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-vi.c-Fixed-line-gotos-added-CTL-macro.patch
Type: text/x-patch
Size: 3767 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20231001/c186a798/attachment.bin>


More information about the Toybox mailing list