zsh-workers
 help / color / mirror / code / Atom feed
* added space bug fix
@ 1997-06-26  9:19 Peter Stephenson
  1997-06-27  4:55 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 1997-06-26  9:19 UTC (permalink / raw)
  To: Zsh hackers list

This fixes the extremely annoying bug in zsh 3.1.2 that spaces get
repeatedly added at the end of the line during menucompletion.  It
does it by null-terminating the line when the space is deleted (the
logic is set up so that the space is added in case it isn't menu
completion then deleted again when it turns out it is).

It's possible the line should be null-terminated in zle_refresh.c
instead/also, or that some other code should pay more attention to the
line length variable ll, but I don't dare touch any of that.

*** Src/Zle/zle_utils.c.sc	Sun Jun  1 07:50:52 1997
--- Src/Zle/zle_utils.c	Thu Jun 26 11:06:10 1997
***************
*** 75,81 ****
  	line[to] = line[to + cnt];
  	to++;
      }
!     ll = to;
  }
  
  /**/
--- 75,81 ----
  	line[to] = line[to + cnt];
  	to++;
      }
!     line[ll = to] = '\0';
  }
  
  /**/

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


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

* Re: added space bug fix
  1997-06-26  9:19 added space bug fix Peter Stephenson
@ 1997-06-27  4:55 ` Zoltan Hidvegi
  0 siblings, 0 replies; 2+ messages in thread
From: Zoltan Hidvegi @ 1997-06-27  4:55 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

> This fixes the extremely annoying bug in zsh 3.1.2 that spaces get
> repeatedly added at the end of the line during menucompletion.  It
> does it by null-terminating the line when the space is deleted (the
> logic is set up so that the space is added in case it isn't menu
> completion then deleted again when it turns out it is).
> 
> It's possible the line should be null-terminated in zle_refresh.c
> instead/also, or that some other code should pay more attention to the
> line length variable ll, but I don't dare touch any of that.

No, your patch is absolutely correct and does the Right Thing.  It was me
who introduced this bug.  Shiftchars used to copy line[ll] but I changed
it because a memory debugger tool noticed that it is reading
uninitialised memory (although that was not a real bug in that case).
When shiftchars is called from zle_tricky.c, the line should be null
terminated.  For some reason this change did not go to the ChangeLog,
although it is entered in the zle_utils.c RCS log (ChangeLog is
automatically generated from the RCS logs).  I was quite puzzled looking
at the ChangeLog and not seeing anything which can cause this bug.

Thanks,

Zoltan


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

end of thread, other threads:[~1997-06-27  5:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-26  9:19 added space bug fix Peter Stephenson
1997-06-27  4:55 ` Zoltan Hidvegi

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).