From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id UAA10802 for ; Mon, 26 Jun 1995 20:27:32 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA23805 (5.65c/Gatech-10.0-IDA for ); Mon, 26 Jun 1995 06:22:53 -0400 Received: by math (5.x/SMI-SVR4) id AA06866; Mon, 26 Jun 1995 06:19:26 -0400 Resent-Date: Mon, 26 Jun 95 11:19:18 +0100 Old-Return-Path: Message-Id: <25744.9506261019@pyro.swan.ac.uk> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: When does single_line_zle get set? In-Reply-To: "dnelson@xnet.com"'s message of "Sun, 25 Jun 95 21:46:07 CDT." <199506260246.VAA18308@cyclone.xnet.com> Date: Mon, 26 Jun 95 11:19:18 +0100 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-Id: <"36Mee1.0.9h1.jcexl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/112 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu dnelson@xnet.com wrote: > I just compiled zsh-2.6beta9 (was using 2.6beta-3), and now, on initial > login shells, single_line_zle mode gets set on me. I login to an ISP via > modem, and my terminal defaults to 'unknown'. It seems that zsh notices > this and sets single_line_zle (-M) on me. Looks like the problem is that there is a termcap entry for unknown, but it can't go up. The following patch introduces a new state for the termok flag: it becomes -1 if there is a termcap entry but the terminal doesn't have up-line capability. The shell then functions in single line mode until a better terminal comes along, so in practice this does what the manual page says. *** Src/params.c.slz Mon Jun 26 11:02:48 1995 --- Src/params.c Mon Jun 26 11:05:39 1995 *************** *** 1662,1672 **** } } ! /* if there's no termcap entry for cursor up, use single line mode. */ if (!tccan(TCUP)) { tcstr[TCUP] = NULL; ! opts[SINGLELINEZLE] = OPT_SET; } hasam = tgetflag("am"); /* if there's no termcap entry for cursor left, use \b. */ --- 1662,1675 ---- } } ! /* ! * If there's no termcap entry for cursor up, use single line mode. ! * termok is set to -1 to flag this. ! */ if (!tccan(TCUP)) { tcstr[TCUP] = NULL; ! termok = -1; } hasam = tgetflag("am"); /* if there's no termcap entry for cursor left, use \b. */ *** Src/zle_misc.c.slz Mon Jun 26 11:02:48 1995 --- Src/zle_misc.c Mon Jun 26 11:05:37 1995 *************** *** 678,684 **** void tsetcap(int cap, int flag) { ! if (termok && !isset(SINGLELINEZLE) && tcstr[cap]) { if (flag == 0) tputs(tcstr[cap], 1, putshout); else { --- 678,684 ---- void tsetcap(int cap, int flag) { ! if (termok == 1 && !isset(SINGLELINEZLE) && tcstr[cap]) { if (flag == 0) tputs(tcstr[cap], 1, putshout); else { *** Src/zle_refresh.c.slz Mon Jun 26 11:02:48 1995 --- Src/zle_refresh.c Mon Jun 26 11:05:36 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 != 1) winh = 1; else winh = (lines < 2) ? 24 : lines; *************** *** 191,197 **** cleareol = 1; /* set */ if (t0 > -1) olnct = t0; ! if (isset(SINGLELINEZLE) || !termok) vcs = 0; else if (pptlen && !clearflag) { fwrite(pptbuf, pptlen, 1, shout); --- 191,197 ---- cleareol = 1; /* set */ if (t0 > -1) olnct = t0; ! if (isset(SINGLELINEZLE) || termok != 1) vcs = 0; else if (pptlen && !clearflag) { fwrite(pptbuf, pptlen, 1, shout); *************** *** 205,211 **** /* now winw equals columns; now all width comparisons can be made to winw */ ! if (isset(SINGLELINEZLE) || !termok) { singlerefresh(); return; } --- 205,211 ---- /* now winw equals columns; now all width comparisons can be made to winw */ ! if (isset(SINGLELINEZLE) || termok != 1) { singlerefresh(); return; } -- Peter Stephenson Tel: +44 1792 205678 extn. 4461 WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324 Department of Physics, University of Wales, Swansea, Singleton Park, Swansea, SA2 8PP, U.K.