skip CR in interactive mode

This commit is contained in:
devsaurus 2015-11-18 22:07:53 +01:00
parent 99cc9e1232
commit 69f3a6f177

View File

@ -549,12 +549,10 @@ static bool readline(lua_Load *load){
{ {
if(run_input) if(run_input)
{ {
/* handle CR key */ /* skip CR key */
if (ch == '\r') if (ch == '\r')
{ {
char next; continue;
if (uart_getc(&next))
ch = next;
} }
/* backspace key */ /* backspace key */
else if (ch == 0x7f || ch == 0x08) else if (ch == 0x7f || ch == 0x08)
@ -580,7 +578,7 @@ static bool readline(lua_Load *load){
// } // }
/* end of line */ /* end of line */
if (ch == '\r' || ch == '\n') if (ch == '\n')
{ {
load->line[load->line_position] = 0; load->line[load->line_position] = 0;
if(uart0_echo) uart_putc('\n'); if(uart0_echo) uart_putc('\n');