zsh-workers
 help / color / mirror / code / Atom feed
* Second zle_refresh.c patch
@ 1996-07-14 15:34 Geoff Wing
  1996-07-15  4:39 ` Zoltan Hidvegi
  0 siblings, 1 reply; 3+ messages in thread
From: Geoff Wing @ 1996-07-14 15:34 UTC (permalink / raw)
  To: zsh-list

Heyla,
  and here's patch number 2.  Changes are:
* match of only one character doesn't have it use termcap RIGHT or non-
   destructive space (don't output three or more characters to save one).
* a much nicer handling of automargin stuff (especially for those who
   want to cut and paste multiple lines from their prompt in an xterm)
* got rid of a bogus warning Bart Schaefer's compiler throws out.
* fixed an insert bug causing bad displays when termcap INSERT is used
   followed by DELETE (characters pushed off the right are dead)



*** zle_refresh.c.~1~	Sun Jul 14 01:50:22 1996
--- zle_refresh.c	Mon Jul 15 01:16:23 1996
***************
*** 110,116 ****
  }
  
  /*
!  * Jul 96: changed to single line scroll for higher speed terminals - mason
   *  I've seperated the loops for readability (and it's slightly faster)
   *  Returns line number to be used next
   */
--- 110,116 ----
  }
  
  /*
!  * Jul 96: <mason> changed to single line scroll for higher speed terminals
   *  I've seperated the loops for readability (and it's slightly faster)
   *  Returns line number to be used next
   */
***************
*** 196,202 ****
      int ln = 0,			/* current line we're working on	     */
  	nvcs = 0, nvln = -1,	/* video cursor column and line		     */
  	t0 = -1,		/* tmp					     */
! 	tosln;			/* tmp in statusline stuff		     */
      unsigned char *s,		/* pointer into the video buffer	     */
  	*t,			/* pointer into the real buffer		     */
  	*sen,			/* pointer to end of the video buffer (eol)  */
--- 196,202 ----
      int ln = 0,			/* current line we're working on	     */
  	nvcs = 0, nvln = -1,	/* video cursor column and line		     */
  	t0 = -1,		/* tmp					     */
! 	tosln = 0;		/* tmp in statusline stuff		     */
      unsigned char *s,		/* pointer into the video buffer	     */
  	*t,			/* pointer into the real buffer		     */
  	*sen,			/* pointer to end of the video buffer (eol)  */
***************
*** 541,551 ****
  	}
      }
  
  /* 3: main display loop - write out the buffer using whatever tricks we can */
  
      for (;;) {
!     /* skip past all matching characters */
! 	for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
  
  	if (!*nl) {
  	    if ((char_ins <= 0)	|| (ccs >= winw))    /* written everything */
--- 541,563 ----
  	}
      }
  
+ /* 2b: first a new trick for automargin niceness - good for cut and paste */
+ 
+     if (hasam && vcs == winw) {
+ 	vln++, vcs = 1;
+ 	putc(*nbuf[vln], shout);
+ 	nl++;
+ 	if (*ol)
+ 	    ol++;
+ 	ccs = 1;
+     }
+ 
  /* 3: main display loop - write out the buffer using whatever tricks we can */
  
      for (;;) {
! 	if (*nl && nl[1] == ol[1])	/* skip only if second chars match */
! 	/* skip past all matching characters */
! 	    for (; *nl && (*nl == *ol); nl++, ol++, ccs++) ;
  
  	if (!*nl) {
  	    if ((char_ins <= 0)	|| (ccs >= winw))    /* written everything */
***************
*** 595,608 ****
  	}
  
      /* inserting & deleting chars: we can if there's no right-prompt */
! 	if ((ln || !put_rpmpt || !oput_rpmpt)) {
  
  	/* deleting characters - see if we can find a match series that
  	   makes it cheaper to delete intermediate characters
  	   eg. oldline: hifoobar } hopefully cheaper here to delete two
  	       newline: foobar	 } characters, then we have six matches */
! 
! 	    if (tccan(TCDEL) && nl[1] && ol[1] && (ol[1] != nl[1])) {
  		for (i = 0, p1 = ol; *p1; p1++, i++)
  		    if (tcdelcost(i) < pfxlen(p1, nl)) {
  			tc_delchars(i);
--- 607,620 ----
  	}
  
      /* inserting & deleting chars: we can if there's no right-prompt */
! 	if ((ln || !put_rpmpt || !oput_rpmpt) 
! 	    && (nl[1] && ol[1] && nl[1] != ol[1])) { 
  
  	/* deleting characters - see if we can find a match series that
  	   makes it cheaper to delete intermediate characters
  	   eg. oldline: hifoobar } hopefully cheaper here to delete two
  	       newline: foobar	 } characters, then we have six matches */
! 	    if (tccan(TCDEL)) {
  		for (i = 0, p1 = ol; *p1; p1++, i++)
  		    if (tcdelcost(i) < pfxlen(p1, nl)) {
  			tc_delchars(i);
***************
*** 618,625 ****
  	   annihilated, but we don't do this if we're on the last line lest
  	   undesired scrolling occurs due to `illegal' characters on screen */
  
! 	    if ((vln != lines - 1) &&	/* not on last line */
! 		tccan(TCINS) && nl[1] && ol[1] && (ol[1] != nl[1])) {
  		for (i = 0, p1 = nl; *p1; p1++, i++)
  		    if (tcinscost(i) < pfxlen(p1, ol)) {
  			tc_inschars(i);
--- 630,636 ----
  	   annihilated, but we don't do this if we're on the last line lest
  	   undesired scrolling occurs due to `illegal' characters on screen */
  
! 	    if (tccan(TCINS) && (vln != lines - 1)) {	/* not on last line */
  		for (i = 0, p1 = nl; *p1; p1++, i++)
  		    if (tcinscost(i) < pfxlen(p1, ol)) {
  			tc_inschars(i);
***************
*** 628,633 ****
--- 639,650 ----
  			ccs = (vcs += i);
  			nl = p1;
  			char_ins += i;
+ 		    /* if we've pushed off the right, trucate oldline */
+ 			for (j = ccs, p1 = ol; *p1 && j + char_ins < winw;
+ 			     p1++, j++);
+ 			if (j + char_ins == winw)
+ 			    *p1 = '\0';
+ 			p1 = ol;
  			break;
  		    }
  		if (*p1)




-- 
Mason [G.C.W]  mason@werple.mira.net.au    "Hurt...Agony...Pain...LOVE-IT"



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Second zle_refresh.c patch
  1996-07-14 15:34 Second zle_refresh.c patch Geoff Wing
@ 1996-07-15  4:39 ` Zoltan Hidvegi
  1996-07-15  6:31   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Zoltan Hidvegi @ 1996-07-15  4:39 UTC (permalink / raw)
  To: Geoff Wing; +Cc: zsh-workers

> Heyla,
>   and here's patch number 2.  Changes are:

Unfortunately this gets into and infinite loop after pressing up/down arrow
a few times browsing the history.  This happens on Linux with termcap but
does not happen with ncurses.

I'm leaving now so this patch will not be included in pre3.

Zoltan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Second zle_refresh.c patch
  1996-07-15  4:39 ` Zoltan Hidvegi
@ 1996-07-15  6:31   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1996-07-15  6:31 UTC (permalink / raw)
  To: Zoltan Hidvegi, Geoff Wing, zsh-workers

On Jul 15,  6:39am, Zoltan Hidvegi wrote:
} Subject: Re: Second zle_refresh.c patch
}
} > Heyla,
} >   and here's patch number 2.  Changes are:
} 
} Unfortunately this gets into and infinite loop after pressing up/down arrow
} a few times browsing the history.  This happens on Linux with termcap but
} does not happen with ncurses.

I can't make this happen on my Linux box with termcap.  (I don't have
ncurses anywhere on the system.)  I'd been playing with the cvs compctl,
too, so my history was pretty messy, with several cases where indivudual
lines or the bodies of shell functions exceeded the size of the screen.

Are you sure this problem is with Geoff's patch?

Of course, I'm in an xterm, not on the console, so maybe that makes a
difference.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-07-15  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-14 15:34 Second zle_refresh.c patch Geoff Wing
1996-07-15  4:39 ` Zoltan Hidvegi
1996-07-15  6:31   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).