From 9a7e915a9f9510c3edabfd753adbfa1bf36a49c2 Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 11 Mar 2016 22:40:18 +0100 Subject: [PATCH] parser/lexical.c, #6/10, cleanup --- src/frontend/parser/lexical.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/frontend/parser/lexical.c b/src/frontend/parser/lexical.c index 912a4cc25..3516e87cc 100644 --- a/src/frontend/parser/lexical.c +++ b/src/frontend/parser/lexical.c @@ -268,12 +268,13 @@ nloop: goto done; } - // cp_ccom doesn't mess wlist, read only access to wlist->wl_word buf[i++] = '\0'; + linebuf[j++] = '\0'; + + // cp_ccom doesn't mess wlist, read only access to wlist->wl_word cp_ccom(wlist, buf, FALSE); (void) fputc('\r', cp_out); prompt(); - linebuf[j++] = '\0'; for (j = 0; linebuf[j]; j++) #ifdef TIOCSTI (void) ioctl(fileno(cp_out), TIOCSTI, linebuf + j); @@ -296,9 +297,10 @@ nloop: case ESCAPE: if (cp_interactive && !cp_nocc) { + buf[i++] = '\0'; + linebuf[j++] = '\0'; fputs("\b\b \b\b\r", cp_out); prompt(); - linebuf[j++] = '\0'; for (j = 0; linebuf[j]; j++) #ifdef TIOCSTI (void) ioctl(fileno(cp_out), TIOCSTI, linebuf + j); @@ -306,7 +308,6 @@ nloop: fputc(linebuf[j], cp_out); /* But you can't edit */ #endif // cp_ccom doesn't mess wlist, read only access to wlist->wl_word - buf[i++] = '\0'; cp_ccom(wlist, buf, TRUE); goto nloop; }