From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2090 invoked from network); 11 Oct 2001 11:00:10 -0000 Received: from unknown (HELO sunsite.dk) (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Oct 2001 11:00:10 -0000 Received: (qmail 5574 invoked by alias); 11 Oct 2001 11:00:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16011 Received: (qmail 5549 invoked from network); 11 Oct 2001 11:00:01 -0000 From: martin.ebourne@arcordia.com Expiry-Date: Wed, 9 Jan 2002 -1:-1:-1 +0000 Subject: Very odd behaviour with zsh, maybe corruption bug To: zsh-workers@sunsite.dk Date: Thu, 11 Oct 2001 11:57:46 +0100 Message-ID: X-MIMETrack: Serialize by Router on LON-ARCMTA-01/ARCORDIA(Release 5.0.3 (Intl)|21 March 2000) at 10/11/2001 11:58:32 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Hi, Seeing Bart's suggestion to Oliver Kiddle about the use of history-beginning-search-backward/up-line-or-history, I decided that was nearly what I wanted, so decided to fiddle with it until it was exactly what I wanted. Anyhow, it essentially works except that a condition which should evaluate to true is sometimes returning false for no reason I can figure. I'm using zsh-4.1.0-dev-2, and I can reproduce this with zsh -f. It is however not completely reproducible in that it appears to involve some kind of random effect/corruption so it needs a few goes before it happens. I'm using Zsh on: SunOS gdd-odybin2 5.6 Generic_105181-28 sun4u sparc SUNW,Ultra-Enterprise-10000 First extract this into a file: === START bizzarre.sh _up_fn() { if [[ $LBUFFER == *$'\n'* ]] then _searching='' zle .up-line-or-history else _searching=$WIDGET zle .history-beginning-search-backward fi } _down_fn() { setopt local_options set -x if [[ ${LASTWIDGET} == ${_searching} ]] then _searching=$WIDGET zle .history-beginning-search-forward else if [[ $RBUFFER == *$'\n'* ]] then _searching='' zle .down-line-or-history else _searching=$WIDGET zle .history-beginning-search-forward fi fi } zle -N new-up _up_fn zle -N new-down _down_fn bindkey "^[[A" new-up bindkey "^[[B" new-down === END Then execute as here: % zsh -f gdd-odybin2% . ./bizzarre.sh gdd-odybin2% "abc dquote> def" zsh: command not found: abc\ndef gdd-odybin2% Now if I type a single " and play around with using the four cursor keys trying to use the history matching & down, after a couple of minutes I can be pretty sure it will have gone wrong. (Sometimes I ctrl-c or press enter and try again - don't know if that matters.) Once it has gone wrong it appears to continually go wrong until the down function is re-defined (that's the minimum it seems to need to 'reset' it). Due to the 'set -x' you'll get a messed up screen display, but just try and ignore that! The 'gone wrong' is where the following line returns false even though both variables are the same (you can see because of the 'set -x' I added - this was only added for debugging, and isn't needed to make it go wrong). ---> if [[ ${LASTWIDGET} == ${_searching} ]] Here is an example trace where it has gone wrong (once the bug had been 'activated' I just pressed up followed by down to get this): gdd-odybin2% +_down_fn:3> [[ new-up == new-up ]] +_down_fn:8> [[ "abc def" == * * ]] +_down_fn:10> _searching= +_down_fn:11> zle .down-line-or-history gdd-odybin2% As far as I can analyse these variables they are exactly the same, as it appears in the listing, and this first condition should return true, but is actually giving false. Please tell me if I'm doing something obviously stupid, its by far the easist solution. ;) Cheers, Martin. This e-mail message is CONFIDENTIAL and may contain legally privileged information. If you are not the intended recipient you should not read, copy, distribute, disclose or otherwise use the information in this e-mail. Please also telephone or fax us immediately and delete the message from your system. E-mail may be susceptible to data corruption, interception and unauthorised amendment, and we do not accept liability for any such corruption, interception or amendment or the consequences thereof.