Another VI bug ... + A FIX

Michael Greim greim at sbsvax.UUCP
Wed Jul 27 02:21:57 AEST 1988


This bug was discovered by Dan Ts'o (tso at rockefeller.edu) and
reported in <179 at rna.UUCP> in newsgroups comp.bugs.4bsd and
comp.bugs.misc.
Here I present a fix for it. Tell me, if it breaks something else.

Symptoms:
	you need 2 files with some lines in each
	-  edit file1
	-  go to the beginning of the file
	-  say ":$r file2". This appends the contents of file2 correctly
	-  say "u" to undo the "read"
	----> the correct number of lines are deleted but starting from
	      the line your cursor was on, when saying ":$r file2"

Diagnosis:
	When reading from a file, vi has to save the address where the append
	started to make "undo" possible. But the saved value is "dot", the
	current line, *not* the line specified in the "read" command.


Therapy:
	Apply the following fix

*** ex_io.c.old	Tue Jul 26 17:59:12 1988
--- ex_io.c	Tue Jul 26 17:52:04 1988
***************
*** 405,412 ****
  		setdot();
  	else
  		setall();
  	if (FIXUNDO && inopen && c == 'r')
! 		undap1 = undap2 = dot + 1;
  	rop2();
  	rop3(c);
  }
--- 405,422 ----
  		setdot();
  	else
  		setall();
+ 	/* mg, 26.jul.88
+ 	 * undap[12] remember the adress where the input text is going
+ 	 * formerly :
+ 	 *if (FIXUNDO && inopen && c == 'r')
+ 	 *	undap1 = undap2 = dot + 1;
+ 	 * But the address of the text really is addr2, so
+ 	 * command "$r file" followed by "1G" "u" caused wrong lines to
+ 	 * be deleted.
+ 	 * See below in rop2, when first is set.
+ 	 */
  	if (FIXUNDO && inopen && c == 'r')
! 		undap1 = undap2 = addr2 + 1;
  	rop2();
  	rop3(c);
  }




Absorb, apply and enjoy,
	-mg


-- 
+------------------------------------------------------------------------------+
| UUCP:  ...!uunet!unido!sbsvax!greim   | Michael T. Greim                     |
|        or greim at sbsvax.UUCP           | Universitaet des Saarlandes          |
| CSNET: greim%sbsvax.uucp at Germany.CSnet| FB 10 - Informatik (Dept. of CS)     |
| ARPA:  greim%sbsvax.uucp at uunet.UU.NET | Bau 36, Im Stadtwald 15              |
| Phone: +49 681 302 2434               | D-6600 Saarbruecken 11, West Germany |
+------------------------------------------------------------------------------+
| # include <disclaimers/std.h>                                                |
+------------------------------------------------------------------------------+



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