From 346825df86466cf151be61b9429ef2c1734e66ea Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 27 Jun 1999 05:33:04 +0000 Subject: zsh-3.1.5-pws-24 --- Src/input.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'Src/input.c') diff --git a/Src/input.c b/Src/input.c index b4a6fe22d..d05c75c0b 100644 --- a/Src/input.c +++ b/Src/input.c @@ -186,6 +186,8 @@ ingetc(void) inbufct--; if (itok(lastc = STOUC(*inbufptr++))) continue; + if (((inbufflags & INP_LINENO) || !strin) && lastc == '\n') + lineno++; return lastc; } @@ -279,23 +281,20 @@ inputline(void) zputs(ingetcline, stderr); fflush(stderr); } - if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n') { - /* We've now read a complete line. */ - lineno++; - if (interact && isset(SUNKEYBOARDHACK) && isset(SHINSTDIN) && - SHTTY != -1 && *ingetcline && ingetcline[1] && - ingetcline[strlen(ingetcline) - 2] == '`') { - /* Junk an unmatched "`" at the end of the line. */ - int ct; - char *ptr; - - for (ct = 0, ptr = ingetcline; *ptr; ptr++) - if (*ptr == '`') - ct++; - if (ct & 1) { - ptr[-2] = '\n'; - ptr[-1] = '\0'; - } + if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n' && + interact && isset(SUNKEYBOARDHACK) && isset(SHINSTDIN) && + SHTTY != -1 && *ingetcline && ingetcline[1] && + ingetcline[strlen(ingetcline) - 2] == '`') { + /* Junk an unmatched "`" at the end of the line. */ + int ct; + char *ptr; + + for (ct = 0, ptr = ingetcline; *ptr; ptr++) + if (*ptr == '`') + ct++; + if (ct & 1) { + ptr[-2] = '\n'; + ptr[-1] = '\0'; } } isfirstch = 1; @@ -359,6 +358,8 @@ inungetc(int c) inbufptr--; inbufct++; inbufleft++; + if (((inbufflags & INP_LINENO) || !strin) && c == '\n') + lineno--; } #ifdef DEBUG else if (!(inbufflags & INP_CONT)) { -- cgit 1.4.1