Skip to content

Commit

Permalink
FIX: correctly handling multi-line input from PASTE into console in P…
Browse files Browse the repository at this point in the history
…osix version (tested only on Linux so far)
  • Loading branch information
Oldes committed Nov 8, 2017
1 parent 07831f5 commit 2ad2f1d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/os/posix/host-readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 2ad2f1d

Please sign in to comment.