about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-05 01:44:04 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-05 01:44:04 +0000
commitcf0e1c9dca0071716d1952a6b1a552724ea06470 (patch)
treea586517d1499768827493045794d6f2586c736d2
parent20adb2a9ea61b14d2795d33ce57a44d8cf5d3340 (diff)
downloadzsh-cf0e1c9dca0071716d1952a6b1a552724ea06470.tar.gz
zsh-cf0e1c9dca0071716d1952a6b1a552724ea06470.tar.xz
zsh-cf0e1c9dca0071716d1952a6b1a552724ea06470.zip
zsh-workers/9212
-rw-r--r--Src/Zle/zle_hist.c14
-rw-r--r--Src/Zle/zle_main.c15
-rw-r--r--Src/zsh.h4
3 files changed, 14 insertions, 19 deletions
diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c
index d6dc2a794..b43f00bb3 100644
--- a/Src/Zle/zle_hist.c
+++ b/Src/Zle/zle_hist.c
@@ -30,12 +30,6 @@
 #include "zle.mdh"
 #include "zle_hist.pro"
 
-/* Are references to earlier history lines permitted?  == 0 if       *
- * editing or reading a standalone line, such as in vared or select. */
-
-/**/
-int histallowed;
-
 /* Column position of vi ideal cursor.  -1 if it is unknown -- most *
  * movements and changes do this.                                   */
 
@@ -126,7 +120,7 @@ uplineorhistory(char **args)
 	int m = zmult, ret;
 
 	cs = ocs;
-	if (virangeflag || !histallowed)
+	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
 	ret = uphistory(args);
@@ -156,7 +150,7 @@ uplineorsearch(char **args)
 	int m = zmult, ret;
 
 	cs = ocs;
-	if (virangeflag || !histallowed)
+	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
 	ret = historysearchbackward(args);
@@ -210,7 +204,7 @@ downlineorhistory(char **args)
 	int m = zmult, ret;
 
 	cs = ocs;
-	if (virangeflag || !histallowed)
+	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
 	ret = downhistory(args);
@@ -240,7 +234,7 @@ downlineorsearch(char **args)
 	int m = zmult, ret;
 
 	cs = ocs;
-	if (virangeflag || !histallowed)
+	if (virangeflag || !(zlereadflags & ZLRF_HISTORY))
 	    return 1;
 	zmult = n;
 	ret = historysearchforward(args);
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 11c106be5..722612421 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -46,6 +46,11 @@ mod_export int incompfunc;
 /**/
 mod_export int hascompmod;
 
+/* ZLRF_* flags passed to zleread() */
+
+/**/
+int zlereadflags;
+
 /* != 0 if we're done editing */
 
 /**/
@@ -447,8 +452,6 @@ getkey(int keytmout)
     return ret;
 }
 
-static int no_restore_tty;
-
 /* Read a line.  It is returned metafied. */
 
 /**/
@@ -505,8 +508,8 @@ zleread(char *lp, char *rp, int flags)
     pmpt_attr = txtchange;
     rpromptbuf = promptexpand(rp, 1, NULL, NULL);
     rpmpt_attr = txtchange;
-    histallowed = (flags & ZLRF_HISTORY);
     PERMALLOC {
+	zlereadflags = flags;
 	histline = curhist;
 #ifdef HAVE_SELECT
 	FD_ZERO(&foofd);
@@ -540,8 +543,6 @@ zleread(char *lp, char *rp, int flags)
 	if (tmout)
 	    alarm(tmout);
 	zleactive = 1;
-	if (flags & ZLRF_NOSETTY)
-	  no_restore_tty = 1;
 	resetneeded = 1;
 	errflag = retflag = 0;
 	lastcol = -1;
@@ -592,7 +593,7 @@ zleread(char *lp, char *rp, int flags)
 	trashzle();
 	free(lpromptbuf);
 	free(rpromptbuf);
-	zleactive = no_restore_tty = 0;
+	zleactive = zlereadflags = 0;
 	alarm(0);
     } LASTALLOC;
     freeundo();
@@ -974,7 +975,7 @@ trashzle(void)
 	    fprintf(shout, "%s", postedit);
 	fflush(shout);
 	resetneeded = 1;
-	if (!no_restore_tty)
+	if (!(zlereadflags & ZLRF_NOSETTY))
 	  settyinfo(&shttyinfo);
     }
     if (errflag)
diff --git a/Src/zsh.h b/Src/zsh.h
index a5e817019..2ae640a20 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1642,8 +1642,8 @@ struct heap {
 /* Flags to third argument of zle */
 /**********************************/
 
-#define ZLRF_HISTORY	0x01
-#define ZLRF_NOSETTY	0x02
+#define ZLRF_HISTORY	0x01	/* OK to access the history list */
+#define ZLRF_NOSETTY	0x02	/* Don't set tty before return */
 
 /****************/
 /* Entry points */