[Toybox] [PATCH] vi: fix warnings, improve status display.

enh enh at google.com
Wed Jan 8 22:44:48 PST 2020


(if you're wondering "what warnings?" --- i should have said that
glibc used to have the warn_unused_result attribute on mbtowc, and
bionic still does. i don't know why glibc removed it, though arguably
in this specific case where the two pointers are null [because you
just want to reset the decoder state], ignoring the result is not
unreasonable. but not reusing the existing toybox utf8 code is
definitely unreasonable :-) )

On Wed, Jan 8, 2020 at 10:41 PM enh <enh at google.com> wrote:
>
> mbtowc(0, 0, 4) is weird, and ignoring the result is weird. Avoid all
> this by just reusing the toybox lib utf8 functions.
>
> Also fix the row/column display on the status line to count from 1 and
> correctly distinguish bytes and characters in non-ASCII, and change the
> mode output to only explicitly say when we're in insert mode, in the
> same way that vim does. (Every time I saw the old blue-on-black text for
> COMMAND I thought toybox vi had crashed!)
> ---
>  toys/pending/vi.c | 93 +++++++++++------------------------------------
>  1 file changed, 22 insertions(+), 71 deletions(-)



More information about the Toybox mailing list