Another VI bug...

Dan Ts'o dan at rna.UUCP
Sun Jul 24 15:20:02 AEST 1988


	I think I found another VI bug. Sorry if its an oldie, although it
certainly isn't fixed in 4.3BSD.

If you're editing a file and the edit cursor is currently somewhere in the
middle of the file, and you then wish to include the contents of another file,
appending it to the end of the buffer by,

:$r file2

	The file2 contents are appended correctly. If you then change your mind
and type 'u' to undo that read command, VI will delete the appropriate number
of lines -- HOWEVER, not from the end, but from where your cursor currently is.
That is, VI attempts to undo the read command by the correct number of lines,
but ends up deleting those lines from the middle of your buffer, rather than
the lines you read in.
	The problem seems to be that the undo code normally saves the state
prior to any text-changing command, including the position of the cursor.
However, when performing the

:$r files2

	the undo code should really save $ as the position of the cursor.

				Cheers,
				Dan Ts'o		212-570-7671
				Dept. Neurobiology	dan at rna.rockefeller.edu
				Rockefeller Univ.	...cmcl2!rna!dan
				1230 York Ave.		rna!dan at nyu.edu
				NY, NY 10021		tso at rockefeller.edu



More information about the Comp.bugs.4bsd.ucb-fixes mailing list