[net.unix-wizards] vi bug?

msc (04/06/83)

	I have been caught several times by what appears to be a bug in
	vi.  The problem shows up when I am using vi to edit a temporary
	file such as you get after invoking vi with the ~v command from
	mail.  When I try to exit from vi with the ZZ command, I get the
	message "file exists; use w! to overwrite".

	I have no idea what causes this to happen and I am wondering if
	anyone else has noticed this.  It happens about 10% of the times
	I use the ~v command.  It may possibly have some connection with
	doing a :r command, at sometime in the edit, to include the contents
	of another file.

				Mark Callow
				Qubix Graphic Systems Inc.
				...{decvax,ucbvax}!decwrl!qubix!msc
				...ittvax!qubix!msc
				decwrl!qubix!msc@Berkeley.ARPA

shp (04/07/83)

I too have experienced the ~v "use w! to override" problem in vi.  It is
caused by the :r command, but I've never taken the time to look into it.

	- sam praul
	  ...decvax!ittvax!shp

steve@sdcrdcf.UUCP (Steve Holtsberg) (03/01/85)

I have a file whose contents is:
12345
67890

The cursor is on the 1, and I type the following sequence of commands:
ma
f5
y`a
<cr>
P

Now, I think the P should insert 12345 before the 6 on the second line.
Instead, it DELETES the 6789!!  (Try it.)

Am I wrong, or is this a bug?

Steven Holtsberg  (sdcrdcf!steve@UUCP, ucla-cs!holts@UUCP)

ado@elsie.UUCP (Arthur David Olson) (03/06/85)

Index:		ucb/ex/ex_vops.c

Description:
	<1798@sdcrdcf.UUCP>--
    > . ..I have a file whose contents is:
    > 12345
    > 67890
    > 
    > The cursor is on the 1, and I type the following sequence of commands:
    > ma
    > f5
    > y`a
    > <cr>
    > P
    > 
    > Now, I think the P should insert 12345 before the 6 on the second line.
    > Instead, it DELETES the 6789. . .

Repeat-By:
	See above.

Fix:
	The file to be fixed is known as "/usr/src/cmd/ex/ex_vops.c" in 4.1bsd.
	The trade secret status of the code precludes a clearer posting.

 ed /usr/src/cmd/ex/ex_vops.c
 /dot > wdot/c
 #ifdef OLDVERSION
 	if (dot > wdot) {
 #else
 	if (dot > wdot || (dot == wdot && wcursor != 0 && cursor > wcursor)) {
 #endif
 .
 w
 q
--
UNIX and EX are AT&T Bell Laboratories and Elizabeth Taylor trademarks.
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks