*BSD News Article 11582


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA1693 ; Tue, 23 Feb 93 14:53:56 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!sun-barr!cs.utexas.edu!news
From: cloyce@cs.utexas.edu (Cloyce D. Spradling)
Newsgroups: comp.os.386bsd.questions
Subject: Re: patch to vi editor (pt. 1 -- the bugfix)
Date: 19 Feb 1993 11:45:53 -0600
Organization: CS Dept, University of Texas at Austin
Lines: 48
Message-ID: <loa76hINN40u@dimebox.cs.utexas.edu>
References: <C2nKsx.9Mp@ux1.cso.uiuc.edu> <lo8q52INNgh@dimebox.cs.utexas.edu> <CGD.93Feb18210248@eden.CS.Berkeley.EDU>
NNTP-Posting-Host: dimebox.cs.utexas.edu

In article <CGD.93Feb18210248@eden.CS.Berkeley.EDU> cgd@eden.CS.Berkeley.EDU (Chris G. Demetriou) writes:
>In article <lo8q52INNgh@dimebox.cs.utexas.edu> cloyce@cs.utexas.edu (Cloyce D. Spradling) writes:
>>On a related note, has anyone but me experienced the problem of hitting 'dd'
>>and having elvis erase the line *above* the one the cursor is on?
>
>i've not seen this problem...  however, sometimes it *appears* to have
>deleted the line above the one w/the cursor, but hitting control-l
>shows that it did, in fact delete the correct line...

Ah...stupid Cloyce did not think of trying this.  You can bet he will the
next time it happens.

Here is the fix for the problem of vi erasing lines whenever you do insert
at the beginning of a line (with characters), and press return.
Actually, this occurs if the text that you're inserting into is any whitespace
before a character, and not following any characters.  Hmmm...that's a bit
confusing, but I'll leave it at that.  The patch is pretty self-explanatory.

*** /usr/src/usr.bin/elvis/input.c.orig	Thu Dec 17 09:02:11 1992
--- /usr/src/usr.bin/elvis/input.c	Thu Dec 17 08:27:20 1992
***************
*** 699,705 ****
  					if ((scan - ptext) >= markidx(cursor) && plen > 0)
  					{
  						to = cursor &= ~(BLKSIZE - 1);
! 						delete(cursor, cursor + plen);
  					}
  				}
  				*build = 0;
--- 699,709 ----
  					if ((scan - ptext) >= markidx(cursor) && plen > 0)
  					{
  						to = cursor &= ~(BLKSIZE - 1);
!          /*
!           * CDS 15 Dec 1992 -- delete only unneeded whitespace, not whole line!
! 					* delete(cursor, cursor + plen);
!           */
! 						delete(cursor, cursor + (scan - ptext));
  					}
  				}
  				*build = 0;


------------ END OF PATCH -----------

-- 
| Cloyce D. Spradling    |           cloyce@{ccwf.cc, cs}.utexas.edu           |
| No matter how you think, you're still only *simulating* logic! |   ENTROPY!  |