Skip to content

Commit 2ad2f1d

Browse files
committed
FIX: correctly handling multi-line input from PASTE into console in Posix version (tested only on Linux so far)
1 parent 07831f5 commit 2ad2f1d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/os/posix/host-readline.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,9 @@ static struct termios Term_Attrs; // Initial settings, restored on exit
589589
{
590590
char buf[READ_BUF_LEN];
591591
char *cp;
592+
char *pp;
592593
int len; // length of IO read
594+
int line_end_reached = 0;
593595

594596
term->pos = term->end = 0;
595597
term->hist = Line_Count;
@@ -599,9 +601,14 @@ static struct termios Term_Attrs; // Initial settings, restored on exit
599601
do {
600602
Read_Bytes(term, buf, READ_BUF_LEN-2);
601603
for (cp = buf; *cp;) {
604+
pp = cp;
602605
cp = Process_Key(term, cp);
606+
if(pp[0] == CR || pp[0] == LF) {
607+
line_end_reached = 1;
608+
break;
609+
}
603610
}
604-
} while (!term->out);
611+
} while (!line_end_reached && !term->out);
605612

606613
// Not at end of input? Save any unprocessed chars:
607614
if (*cp) {

0 commit comments

Comments
 (0)