nvi2
nvi2 copied to clipboard
Cannot insert blank line in global insert mode
To reproduce:
$ cat file
enum
$ printf '%s\n' 'g/enum/i\' '\' '.' '%p' | nvi -e file
Expected output:
enum
Actual output:
enum
The correct behavior is observed in ed and classic vi/ex (tested on OpenIndiana 2024.04).
The debugger leads me to https://github.com/lichray/nvi2/blob/52c07e84df713c967568b610294aa1d3f5b3f38a/ex/ex_append.c#L110-L147 Is this document relevant?
Yes, somewhat, I think this is just a bug. A possible fix is to just remove the if (t != p || len == 0) check (I suggested it to the nvi maintainers to validate it), but it seems correct.
This has been fixed upstream - https://repo.or.cz/nvi.git/commitdiff/957906b0e3bcc0f795cf8c6b7313fcc4ec338784