From 2ad2f1d2e3663c689133ee34b215105e2036fba2 Mon Sep 17 00:00:00 2001 From: oldes Date: Wed, 8 Nov 2017 11:31:03 +0100 Subject: [PATCH] FIX: correctly handling multi-line input from PASTE into console in Posix version (tested only on Linux so far) --- src/os/posix/host-readline.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/os/posix/host-readline.c b/src/os/posix/host-readline.c index 1735aac48b..c772082deb 100644 --- a/src/os/posix/host-readline.c +++ b/src/os/posix/host-readline.c @@ -589,7 +589,9 @@ static struct termios Term_Attrs; // Initial settings, restored on exit { char buf[READ_BUF_LEN]; char *cp; + char *pp; int len; // length of IO read + int line_end_reached = 0; term->pos = term->end = 0; term->hist = Line_Count; @@ -599,9 +601,14 @@ static struct termios Term_Attrs; // Initial settings, restored on exit do { Read_Bytes(term, buf, READ_BUF_LEN-2); for (cp = buf; *cp;) { + pp = cp; cp = Process_Key(term, cp); + if(pp[0] == CR || pp[0] == LF) { + line_end_reached = 1; + break; + } } - } while (!term->out); + } while (!line_end_reached && !term->out); // Not at end of input? Save any unprocessed chars: if (*cp) {