<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 24, 2023, 22:45 Oliver Webb via Toybox <<a href="mailto:toybox@lists.landley.net">toybox@lists.landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have been changing the ex command processor in vi.c to have things like line<br>
ranges, commands like g, v, d, and p (and s but I haven't gotten to<br>
even starting that yet), System commands and the ability to pipe text into them<br>
and put it back into your file, etc. I have a half finished version of line range<br>
implementation. But rather then submit that half finished version, I'll just submit<br>
the things required for that to work, along with some other small things<br>
<br>
The main thing is that strncmp() or just cmd[num] == 'char' (To find a command at a specific location)<br>
be used instead of strstr() (Which finds any mention of the string in the command)<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">i haven't looked at the patch, but the toybox strstart() function is often useful for writing this kind of thing clearly.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Commands like ":%s/wq!/set nolist/g" would break otherwise.<br>
<br>
I added the ability to jump to lines with :[NUMBER], go to the bottom of the file with ":$" and delete lines with the d command,<br>
I know that these commands can be replicated in normal mode (the d command just calls run_vi_command("dd"))<br>
but when combined with things like the g command that I plan to submit in later patches<br>
They can add some power to the text processing capabilities of the editor<br>
(Example: ":g/\s*#/d" to delete all lines with only "#" style comments, ":%d" to clear the buffer)<br>
<br>
Other then that, I fixed a error that happens whenever ":w " is inputted by changing<br>
xrename() to rename(), preventing a early exit without properly setting the terminal<br>
back to normal beforehand.<br>
<br>
Last thing I did was replacing stuff like 0x20 with ' ', 0x0A with '\n', etc. To make it more clear we<br>
are checking for certain characters. '\t' Conveys more info then 0x09 anyways even _if_<br>
you know the ASCII control codes and their hexadecimal values anyways.<br>
And stuff like "0x4" conveys nothing by being hexadecimal.</blockquote></div></div><div dir="auto"><br></div><div dir="auto">yeah, i've added a `CTRL()` macro in a few places to be able to make the ('d'-'@') a bit more intention-revealing. personally i'd like to promote that to one of the global headers so we can just consistently write CTRL('x') or whatever without worrying about mental arithmetic...</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> _______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank" rel="noreferrer">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div></div></div>