From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27002 invoked from network); 26 Apr 2001 12:28:55 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Apr 2001 12:28:55 -0000 Received: (qmail 20758 invoked by alias); 26 Apr 2001 12:28:37 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3832 Received: (qmail 20744 invoked from network); 26 Apr 2001 12:28:36 -0000 Date: Thu, 26 Apr 2001 11:07:19 +0200 (CEST) From: Christoph Lange Reply-To: Christoph Lange To: Bart Schaefer cc: zsh-users@sunsite.auc.dk Subject: Re: IGNORE_EOF like in bash In-Reply-To: <1010426034956.ZM11913@candle.brasslantern.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII > With your function, IGNOREEOF=3 will require four ^D to exit, or two ^D > and then anything else, repeated four times (because it never starts > __BASH_IGNORE_EOF over at three after the first call to this function). > > I think you want: > > bash-ctrl-d() { > if [[ $CURSOR == 0 && -z $BUFFER ]] > then > [[ -z $IGNOREEOF || $IGNOREEOF == 0 ]] && exit > if [[ $LASTWIDGET == bash-ctrl-d ]] > then > (( --__BASH_IGNORE_EOF <= 0 )) && exit > else > (( __BASH_IGNORE_EOF = IGNOREEOF-1 )) > fi > zle send-break > else > zle delete-char-or-list > fi > } Thanks for correcting my hack. However, __BASH_IGNORE_EOF should be initialized with the value of IGNOREEOF for a bash-like implementation. IGNOREEOF=3 in bash means that EOF is ignored three times. Only the 4th EOF is not ignored and exits the shell. Christoph -- Computer, n.: A device designed to speed and automate errors Christoph Lange, langec@gmx.de, http://www.cul.de/home/yaph/, ICQ #51191833