Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zle_refresh.c patch (Was: New zed and refresh bug)



I wrote:
:Zoltan Hidvegi wrote:
::> Zoltan wrote:
::> :It demonstrates a zle bug.  Just load this zed function, unset the BAUD
::> :parameter (to get half-screen scrolls in zed), invoke zed -f zed, and use
::> :the up-arrow to move to the top of the function.  On a 80x25 Linux console
::> :with ncurses a bogous `if [[ -f $dir/$1 ]' appears on the 5th screen line
::> :after the second half-screen scroll.
:OK. I can repro it now - doesn't look good.  Yep, looks like an insert problem.
:Will send a fix in soon (Should be today or tomorrow (Wednesday)).  Also will
:change 9600 to 19200 as the minimum speed for single line scroll (unless anyone
:thinks it should be 38400?)

I'll go over the logic for this again to confirm it but this should fix it.
I used the number of inserted characters twice in the calculations.

A couple of other matters: 
1) If you have a line with more than a screenful of stuff, then CTRL-U it
 (kill-whole-line), you don't always get your RPROMPT rewritten.  I haven't
 found an exact repro method yet (nor checked the code).  Will look into it
 a bit later.
2) testing "zed -f zed" lots of times and moving up and down between
 screenfuls twenty or more times, spewed out some allocation errors and
 coredumped.  This is with all the ZSH_MEM stuff compiled in.  The coredump
 didn't make sense (said it died during a putc() which was valid) and
 I've lost that coredump (overwritten by others) and I can't repro it.
 So unless someone else comes across it, nothing can be done.  Perhaps it was
 due to my OS (NetBSD 1.2_BETA).
 I'm just mentioning this to encourage testers to compile in ZSH_MEM stuff
 Perhaps we need an option in configure: --enable-zsh-debug-all  which enables
 all the zsh configure options? (Save me having to type in six --enable things
 every time :-)

Anyway, here's the patch:

*** zle_refresh.c	1996/07/19 17:04:33	2.9
--- zle_refresh.c	1996/07/30 05:45:42
***************
*** 122,128 ****
      int t0, hwinh;
      char *s;
  
!     if (tline || baudrate >= 9600) {	/* single line scroll */
  	hwinh = 1;
  	s = nbuf[tline];
  	for (t0 = tline; t0 < winh - 1; t0++)
--- 122,128 ----
      int t0, hwinh;
      char *s;
  
!     if (tline || baudrate >= 19200) {	/* single line scroll */
  	hwinh = 1;
  	s = nbuf[tline];
  	for (t0 = tline; t0 < winh - 1; t0++)
***************
*** 642,648 ****
  			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';
--- 642,648 ----
  			nl = p1;
  			char_ins += i;
  		    /* if we've pushed off the right, trucate oldline */
! 			for (j = ccs - i, p1 = ol; *p1 && j + char_ins < winw;
  			     p1++, j++);
  			if (j + char_ins == winw)
  			    *p1 = '\0';


-- 
Geoff Wing [mason@xxxxxxxxxxxxxxx] PrimeNet - Internet Consultancy



Messages sorted by: Reverse Date, Date, Thread, Author