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

Re: IGNORE_EOF like in bash



> 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@xxxxxx, http://www.cul.de/home/yaph/, ICQ #51191833




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