lichray / nvi2

A multibyte fork of the nvi editor for BSD
Other
146 stars 34 forks source link

Cannot insert blank line in global insert mode #134

Open mohd-akram opened 4 months ago

mohd-akram commented 4 months ago

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).

lichray commented 4 months ago

The debugger leads me to https://github.com/lichray/nvi2/blob/52c07e84df713c967568b610294aa1d3f5b3f38a/ex/ex_append.c#L110-L147 Is this document relevant?

mohd-akram commented 4 months ago

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.