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

PATCH: exiting shell from widget



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@xxxxxxx>                  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
**********************************************************************



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