Closed larryhynes closed 7 years ago
Like vim, nvi had been written from scratch. Whereas vim tries to be as compatible as possible--even for "bugs" (not in any case--there are details which differ from vi), nvi likely tries to be a better or "always correct" vi (although Wikipedia describes it as "bug for bug" compatible with vi too). Note that vim predates nvi. Or maybe Keith just had not been aware of this issue. So I agree, there is an inconsistency between vi and nvi here, but I'd prefer to declare it as a "feature" rather than fixing it ;)
Well, leaving vim and nvi aside, I think heirloom vi's behaviour here could be improved or - dare I say it? - fixed! So, that would be my vote, if such a thing mattered. ;^)
Ok, if nobody else disagrees I'll work on that. (Busy with other projects I can't address it in the short term, unfortunately.)
This bug is in every original vi version which support these commands, so heirloom-vi will then be incompatible here. Nevertheless it is a bug reasonable to be fixed (i.e. the current "feature" in vi and vim is IMHO not of any use).
Bad news on this--I'm quite sure that the bug is in nvi, not in vi and vim. If a paste works line-wise or character-wise depends on the last character of the yank buffer. If it is a newline the the paste is line-wise, else character-wise. You can test that--if you start a "ay}
yank in the middle of a paragraph the paste will be character-wise, since in this case no new-line is appended (use :registers
in vim). This is also the case for the last paragraph which does not end with a new-line. Hence nvi behaves wrong here ;)
That makes a lot of sense, thanks for taking the time to look into it and for clarifying it.
Hi
In a test file:
1G"ay}G"ap
yields:but
1G}"ay}G"ap
yields:vim behaves the same, (n)vi on OpenBSD does not (OpenBSDs vi returns the same output as the first example, which is what I would expect vi to do).
This is either an inconsistency in vi, or a fault in my expectations! :smile: