[Toybox] [PATCH] vi: fix recent changes.

Rob Landley rob at landley.net
Wed Jan 12 12:07:24 PST 2022

On 1/10/22 9:07 PM, enh via Toybox wrote:
> vi was segfaulting because some of the printf() arguments were the wrong
> way round. The file content also wasn't getting displayed because [%dH
> isn't a correct translation of tty_jump(0, y). Personally, although I
> agree that tty_esc() wasn't pulling its weight, I think that tty_jump()
> was: the escape sequence's arguments are the wrong way round, they're
> both off-by-one, and the rules for the short forms don't make sense to
> humans, just to 1970s hardware.

Yeah, I've been unsure about that. I blogged about it at the time:


But just now got my blog editing/uploading caught up that far. :)

The motivation for puttering around here is A) fixing microcom so it doesn't
screw up tabs by getting raw mode wrong, B) implementing command editing/history
for the shell.

The problem I hit _here_ is I keep forgetting other people use stuff out of
pending, and haven't got good tests for vi so didn't bother to test it.

I'm not sure _how_ to test vi in any sort of automated fashion? First time I sat
down to try it, the code barfed trying to edit an empty file, so it didn't
exactly strike me as load bearing yet...

Trying it now editing the README, when you cursor up and down it jumps to the
left edge of the file. I cursored to the middle of a line, hit "insert" and
typed the word "potato", then hit cursor down and the new word I'd added jumped
to the left edge of that line and followed my cursor down multipline lines. When
I hit "esc" to exit insert mode, the word potato stayed there but I dunno if
that was a display glitch or where it decided to update the state? (I exited
without saving.)

Again, promoting this out of pending is going to involve going over every corner
case in the thing with a jewler's loupe. What's currently there is... unfinished.


More information about the Toybox mailing list