zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: exiting shell from widget
@ 2004-09-21 13:09 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2004-09-21 13:09 UTC (permalink / raw)
  To: Zsh hackers list

This chunk is needed if you want to be able to exit the shell cleanly
from a zle widget (without prejudice to any circumstances whatsoever
when you might or might not wish to do that).  The comment explains why.

Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.53
diff -u -r1.53 zle_main.c
--- Src/Zle/zle_main.c	20 Sep 2004 14:04:03 -0000	1.53
+++ Src/Zle/zle_main.c	21 Sep 2004 13:08:37 -0000
@@ -680,7 +680,13 @@
     FD_ZERO(&foofd);
 #endif
 
-    while (!done && !errflag) {
+    /*
+     * A widget function may decide to exit the shell.
+     * We never exit directly from functions, to allow
+     * the shell to tidy up, so we have to test for
+     * that explicitly.
+     */
+    while (!done && !errflag && !exit_pending) {
 
 	statusline = NULL;
 	vilinerange = 0;

-- 
Peter Stephenson <pws@csr.com>                  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
**********************************************************************


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-21 13:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 13:09 PATCH: exiting shell from widget Peter Stephenson

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