Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: When does single_line_zle get set?
- X-seq: zsh-workers 623
- From: Peter Stephenson <pws@xxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: When does single_line_zle get set?
- Date: Fri, 17 Nov 1995 17:38:01 +0100
- In-reply-to: "p.stephenson@xxxxxxxxxxxxx"'s message of "Mon, 26 Jun 1995 11:19:18 MET." <25744.9506261019@xxxxxxxxxxxxxxx>
Here's a repeat of a patch fixing the following problem: if the shell
starts with TERM set to something which exists but doesn't have
up-line, SINGLE_LINE_ZLE gets set. The problem is that it stays set
if the TERM gets changed (unlike if the initial setting was complete
nonsense). As this happens for an initial setting of `unknown' on a
lot of machines, this is bad news for users.
The new patch is necessary because the termcap code has been moved
around. I've made it smarter with some definitions, but it does
exactly the same thing it did before.
*** Src/init.c.sl Fri Nov 17 17:15:16 1995
--- Src/init.c Fri Nov 17 17:21:40 1995
***************
*** 427,433 ****
init_term(void)
{
if (!*term)
! return termok = 0;
/* unset zle if using zsh under emacs */
if (!strcmp(term, "emacs"))
--- 427,433 ----
init_term(void)
{
if (!*term)
! return termok = TERM_BAD;
/* unset zle if using zsh under emacs */
if (!strcmp(term, "emacs"))
***************
*** 437,448 ****
if (isset(INTERACTIVE))
zerr("can't find termcap info for %s", term, 0);
errflag = 0;
! return termok = 0;
} else {
char tbuf[1024], *pp;
int t0;
! termok = 1;
for (t0 = 0; t0 != TC_COUNT; t0++) {
pp = tbuf;
zsfree(tcstr[t0]);
--- 437,448 ----
if (isset(INTERACTIVE))
zerr("can't find termcap info for %s", term, 0);
errflag = 0;
! return termok = TERM_BAD;
} else {
char tbuf[1024], *pp;
int t0;
! termok = TERM_OK;
for (t0 = 0; t0 != TC_COUNT; t0++) {
pp = tbuf;
zsfree(tcstr[t0]);
***************
*** 458,467 ****
/* check whether terminal has automargin (wraparound) capability */
hasam = tgetflag("am");
! /* if there's no termcap entry for cursor up, use single line mode. */
if (!tccan(TCUP)) {
tcstr[TCUP] = NULL;
! opts[SINGLELINEZLE] = OPT_SET;
}
/* if there's no termcap entry for cursor left, use \b. */
--- 458,469 ----
/* check whether terminal has automargin (wraparound) capability */
hasam = tgetflag("am");
! /* if there's no termcap entry for cursor up, use single line mode: *
! * this is flagged by termok which is examined in zle_refresh.c *
! */
if (!tccan(TCUP)) {
tcstr[TCUP] = NULL;
! termok = TERM_NOUP;
}
/* if there's no termcap entry for cursor left, use \b. */
***************
*** 515,521 ****
bangchar = '!';
hashchar = '#';
hatchar = '^';
! termok = 0;
curjob = prevjob = coprocin = coprocout = -1;
gettimeofday(&shtimer, &dummy_tz); /* init $SECONDS */
srand((unsigned int)(shtimer.tv_sec + shtimer.tv_usec)); /* seed $RANDOM */
--- 517,523 ----
bangchar = '!';
hashchar = '#';
hatchar = '^';
! termok = TERM_BAD;
curjob = prevjob = coprocin = coprocout = -1;
gettimeofday(&shtimer, &dummy_tz); /* init $SECONDS */
srand((unsigned int)(shtimer.tv_sec + shtimer.tv_usec)); /* seed $RANDOM */
*** Src/params.c.sl Fri Nov 17 17:24:05 1995
--- Src/params.c Fri Nov 17 17:22:28 1995
***************
*** 1691,1697 ****
/* If non-interactive, delay setting up term till we need it. */
if (unset(INTERACTIVE) || !*term)
! termok = 0;
else
init_term();
}
--- 1691,1697 ----
/* If non-interactive, delay setting up term till we need it. */
if (unset(INTERACTIVE) || !*term)
! termok = TERM_BAD;
else
init_term();
}
*** Src/zle_refresh.c.sl Fri Nov 17 17:18:24 1995
--- Src/zle_refresh.c Fri Nov 17 17:19:25 1995
***************
*** 66,72 ****
static int lwinw = -1, lwinh = -1; /* last window width & height */
winw = (columns < 1) ? (columns = 80) : columns; /* terminal width */
! if (isset(SINGLELINEZLE) || !termok)
winh = 1;
else
winh = (lines < 2) ? 24 : lines;
--- 66,72 ----
static int lwinw = -1, lwinh = -1; /* last window width & height */
winw = (columns < 1) ? (columns = 80) : columns; /* terminal width */
! if (isset(SINGLELINEZLE) || termok != TERM_OK)
winh = 1;
else
winh = (lines < 2) ? 24 : lines;
***************
*** 196,202 ****
cleareol = 1; /* set */
if (t0 > -1)
olnct = t0;
! if (isset(SINGLELINEZLE) || !termok)
vcs = 0;
else if (!clearflag && lpptlen) {
fwrite(lpptbuf, lpptlen, 1, shout);
--- 196,202 ----
cleareol = 1; /* set */
if (t0 > -1)
olnct = t0;
! if (isset(SINGLELINEZLE) || termok != TERM_OK)
vcs = 0;
else if (!clearflag && lpptlen) {
fwrite(lpptbuf, lpptlen, 1, shout);
***************
*** 210,216 ****
/* now winw equals columns; now all width comparisons can be made to winw */
! if (isset(SINGLELINEZLE) || !termok) {
singlerefresh();
return;
}
--- 210,216 ----
/* now winw equals columns; now all width comparisons can be made to winw */
! if (isset(SINGLELINEZLE) || termok != TERM_OK) {
singlerefresh();
return;
}
*** Src/zsh.h.sl Fri Nov 17 17:15:26 1995
--- Src/zsh.h Fri Nov 17 17:23:31 1995
***************
*** 1130,1135 ****
--- 1130,1142 ----
#define txtchangeisset(X) (txtchange & (X))
#define txtchangeset(X, Y) (txtchange |= (X), txtchange &= ~(Y))
+ /* flags for termok state: usually the test for whether termok is set is
+ * enough: in the refresh code we need to know whether the terminal has
+ * an up capability.
+ */
+ #define TERM_BAD 0
+ #define TERM_OK 1
+ #define TERM_NOUP 2
/*********************/
/* Definitions for ? */
--
Peter Stephenson <pws@xxxxxx> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author