1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-04 10:41:11 +02:00

zsh-workers/9212

This commit is contained in:
Tanaka Akira 2000-01-05 01:44:04 +00:00
parent 20adb2a9ea
commit cf0e1c9dca
3 changed files with 14 additions and 19 deletions

View file

@ -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);

View file

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

View file

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