[comp.bugs.4bsd] Another VI bug...

dan@rna.UUCP (Dan Ts'o) (07/24/88)

	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@rna.rockefeller.edu
				Rockefeller Univ.	...cmcl2!rna!dan
				1230 York Ave.		rna!dan@nyu.edu
				NY, NY 10021		tso@rockefeller.edu

aburt@isis.UUCP (Andrew Burt) (07/25/88)

While we're discussing probably-well-known-but-yet-unfixed bugs in vi,
I'd like to see 'R'eplace mode function correctly with tabs: if one
types over a tab it should shift the previously tabbed text to the left so
the poor user knows the next character typed will replace the character
after the tab, not the 2nd "space" character comprising the tab expansion.
-- 

Andrew Burt 				   			ncar!isis!aburt

	      "Now go away or I shall taunt you a second time."

phssra@emory.uucp (Scott R. Anderson) (07/26/88)

In article <2303@isis.UUCP> aburt@isis.UUCP (Andrew Burt) writes:
>While we're discussing probably-well-known-but-yet-unfixed bugs in vi,

Let me add my favorite (grrrr...):  "yank" or "delete" a matched pair of
parentheses, braces, or brackets with y% or d% (a character-oriented copy into
the unnamed buffer), then go somewhere else and "put" it.  Oops!  You made a
mistake, you actually wanted to put it somewhere else, so "undo" and move the
cursor to where you really wanted, and "put" the buffer there.  What's this?
Along with the matched pair, you also get the entire line from where you
mistakenly put it first!  Present in 4.2, still unfixed in 4.3...

*                                     Scott Robert Anderson
  *      **                           gatech!emoryu1!phssra
   *   *    *    **                   phssra@emoryu1.{bitnet,csnet}
    * *      * *    * **
     *        *      *  * * * * * * * * * * * * * * * * * * * * * * * * * * * *