From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13928 invoked from network); 1 Sep 2004 18:12:02 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Sep 2004 18:12:02 -0000 Received: (qmail 10367 invoked from network); 1 Sep 2004 18:11:57 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 18:11:57 -0000 Received: (qmail 8301 invoked by alias); 1 Sep 2004 18:11:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20301 Received: (qmail 8285 invoked from network); 1 Sep 2004 18:11:22 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Sep 2004 18:11:22 -0000 Received: (qmail 7003 invoked from network); 1 Sep 2004 18:10:23 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 18:10:22 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i81IALv11822 for ; Wed, 1 Sep 2004 18:10:21 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 1 Sep 2004 19:09:29 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 1 Sep 2004 19:11:00 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i81IAJvI011849 for ; Wed, 1 Sep 2004 19:10:19 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i81IAJsN011846 for ; Wed, 1 Sep 2004 19:10:19 +0100 Message-Id: <200409011810.i81IAJsN011846@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: zsh exits after delete-char-or-list and two ^Cs In-reply-to: "Bart Schaefer"'s message of "Thu, 26 Aug 2004 17:22:24 PDT." Date: Wed, 01 Sep 2004 19:10:18 +0100 From: Peter Stephenson X-OriginalArrivalTime: 01 Sep 2004 18:11:00.0701 (UTC) FILETIME=[095B48D0:01C4904F] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Bart Schaefer wrote: > There also appears to be a bug in 4.2.x with "zle -I" and "zle -R". This > should work: > > TRAPINT() { zle -I && zle send-break } > > because "zle -I" is supposed to return zero only when zle is active. > However, I get: > > TRAPINT:zle: widgets can only be called when ZLE is active The first problem is that zle -I doesn't have the same test as zle . It's reasonable that it should. The second problem is that the test currently includes the function context. In this case, we've been called from a trap. I'm not convinced this test is necessary; I think it should work as long as zleactive is set, so that we are in a nested context. So I've removed that test. If there are cases where this is problematic, they should be fixed up separately. Actually, the context could be SFC_COMPLETE or SFC_CWIDGET for old- and new-style completion functions, in which case we don't want to allow normal zle widgets. However, I think in this case the existing tests for incompctlfunc and incompfunc are good enough. A simple test seems to indicate they are. It still doesn't work as you expect, since you get the normal effect of ^C as well as the effect of the send-break. I'm not convinced that's a bug, yet. Index: Doc/Zsh/zle.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/zle.yo,v retrieving revision 1.39 diff -u -r1.39 zle.yo --- Doc/Zsh/zle.yo 29 Jul 2004 14:22:21 -0000 1.39 +++ Doc/Zsh/zle.yo 1 Sep 2004 18:02:00 -0000 @@ -507,7 +507,8 @@ The status is zero if zle is active and the current zle display has been invalidated (even if this was by a previous call to `tt(zle -I)'), -else one. +else one. More precisely, the status is zero if zle is currently in a +usable state, i.e. a zle widget can be called immediately. ) item(var(widget) tt([ -n) var(num) tt(]) tt([ -N ]) var(args) ...)( Invoke the specified widget. This can only be done when ZLE is Index: Src/Zle/zle_thingy.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_thingy.c,v retrieving revision 1.13 diff -u -r1.13 zle_thingy.c --- Src/Zle/zle_thingy.c 2 Jun 2004 22:15:02 -0000 1.13 +++ Src/Zle/zle_thingy.c 1 Sep 2004 18:02:02 -0000 @@ -619,6 +619,23 @@ /**/ static int +zle_usable() +{ + return zleactive && !incompctlfunc && !incompfunc +#if 0 + /* + * PWS experiment: commenting this out allows zle widgets + * in signals, hooks etc. I'm not sure if this has a down side; + * it ought to be that zleactive is good enough to test whether + * widgets are callable. + */ + && sfcontext == SFC_WIDGET +#endif + ; +} + +/**/ +static int bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func)) { Thingy t; @@ -629,10 +646,9 @@ if (!wname) { if (saveflag) zmod = modsave; - return (!zleactive || incompctlfunc || incompfunc || - sfcontext != SFC_WIDGET); + return !zle_usable(); } - if(!zleactive || incompctlfunc || incompfunc || sfcontext != SFC_WIDGET) { + if(!zle_usable()) { zwarnnam(name, "widgets can only be called when ZLE is active", NULL, 0); return 1; @@ -685,7 +701,7 @@ static int bin_zle_invalidate(UNUSED(char *name), UNUSED(char **args), UNUSED(Options ops), UNUSED(char func)) { - if (zleactive) { + if (zle_usable()) { if (!trashedzle) trashzle(); return 0; -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************