zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: Open bugs and questions?
Date: Thu, 3 Aug 2000 09:49:41 +0200 (MET DST)	[thread overview]
Message-ID: <200008030749.JAA12195@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Wed, 2 Aug 2000 16:24:26 +0000


Bart Schaefer wrote:

> On Aug 2,  2:08pm, Sven Wischnowsky wrote:
> } Subject: Re: Open bugs and questions?
> }
> } The `use 'exit' to exit' message is displayed slightly differently:
> } below the prompt without displaying a new prompt. Is that ok?
> 
> Perhaps it should respect "alwayslastprompt", or something?  Nah, that's
> overkill.  But how does your change work when ZLE is disabled?

Exactly as before. The change is entirely in zle. Only in zle_main.c, even.

> } Hm, because of that and the shell-function widget thing, I'll wait
> } before committing it.
> 
> I think the shell-function-widget-thing is fine.

Ok, I'll commit it then.

Most of the patch is re-indentation.


Bye
 Sven

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.10
diff -u -r1.10 options.yo
--- Doc/Zsh/options.yo	2000/07/19 21:37:18	1.10
+++ Doc/Zsh/options.yo	2000/08/03 07:48:55
@@ -573,6 +573,11 @@
 of tt(exit) or tt(logout) instead.
 However, ten consecutive EOFs will cause the shell to exit anyway,
 to avoid the shell hanging if its tty goes away.
+
+Also, if this option is set and the Zsh Line Editor is used, widgets
+implemented by shell functions can be bound to EOF (normally
+Control-D) without printing the normal warning message.  This works
+only for normal widgets, not for completion widgets.
 )
 pindex(INC_APPEND_HISTORY)
 cindex(history, incremental appending to a file)
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.8
diff -u -r1.8 zle_main.c
--- Src/Zle/zle_main.c	2000/07/27 17:48:48	1.8
+++ Src/Zle/zle_main.c	2000/08/03 07:48:59
@@ -76,7 +76,10 @@
 /**/
 int insmode;
 
-static int eofchar, eofsent;
+/**/
+mod_export int eofchar;
+
+static int eofsent;
 static long keytimeout;
 
 #ifdef HAVE_SELECT
@@ -556,7 +559,7 @@
 	reselectkeymap();
 	selectlocalmap(NULL);
 	bindk = getkeycmd();
-	if (!ll && isfirstln && c == eofchar) {
+	if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) {
 	    eofsent = 1;
 	    break;
 	}
@@ -630,26 +633,33 @@
     } else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) {
 	int wflags = w->flags;
 
-	if(!(wflags & ZLE_KEEPSUFFIX))
-	    removesuffix();
-	if(!(wflags & ZLE_MENUCMP)) {
-	    fixsuffix();
-	    invalidatelist();
+	if (keybuf[0] == eofchar && !keybuf[1] &&
+	    !ll && isfirstln && isset(IGNOREEOF)) {
+	    showmsg((!islogin) ? "zsh: use 'exit' to exit." :
+		    "zsh: use 'logout' to logout.");
+	    ret = 1;
+	} else {
+	    if(!(wflags & ZLE_KEEPSUFFIX))
+		removesuffix();
+	    if(!(wflags & ZLE_MENUCMP)) {
+		fixsuffix();
+		invalidatelist();
+	    }
+	    if (wflags & ZLE_LINEMOVE)
+		vilinerange = 1;
+	    if(!(wflags & ZLE_LASTCOL))
+		lastcol = -1;
+	    if (wflags & WIDGET_NCOMP) {
+		int atcurhist = histline == curhist;
+		compwidget = w;
+		ret = completecall(args);
+		if (atcurhist)
+		    histline = curhist;
+	    } else
+		ret = w->u.fn(args);
+	    if (!(wflags & ZLE_NOTCOMMAND))
+		lastcmd = wflags;
 	}
-	if (wflags & ZLE_LINEMOVE)
-	    vilinerange = 1;
-	if(!(wflags & ZLE_LASTCOL))
-	    lastcol = -1;
-	if (wflags & WIDGET_NCOMP) {
-	  int atcurhist = histline == curhist;
-	    compwidget = w;
-	    ret = completecall(args);
-	    if (atcurhist)
-		histline = curhist;
-	} else
-	    ret = w->u.fn(args);
-	if (!(wflags & ZLE_NOTCOMMAND))
-	    lastcmd = wflags;
 	r = 1;
     } else {
 	Eprog prog = getshfunc(w->u.fnnam);

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-08-03  7:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-03  7:49 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-08-03 13:32 Sven Wischnowsky
2000-08-02 10:28 Sven Wischnowsky
2000-08-02  9:40 Sven Wischnowsky
2000-08-02  9:51 ` Peter Stephenson
2000-08-03 13:14 ` Andrej Borsenkow
2000-08-02  9:03 Sven Wischnowsky
2000-08-02  9:20 ` Andrej Borsenkow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200008030749.JAA12195@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).