mirror of
https://github.com/vivier/EMILE.git
synced 2024-12-23 01:29:34 +00:00
Correctly manage VT100 control characters on serial port (ignore NULL characters)
This commit is contained in:
parent
c4598cd99c
commit
1c814a938b
10
second/cli.c
10
second/cli.c
@ -35,7 +35,7 @@ void cli_edit(char *s, int length)
|
|||||||
{
|
{
|
||||||
int l = strlen(s);
|
int l = strlen(s);
|
||||||
int pos = l;
|
int pos = l;
|
||||||
int c = 1;
|
int c;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
console_cursor_off();
|
console_cursor_off();
|
||||||
@ -45,6 +45,8 @@ void cli_edit(char *s, int length)
|
|||||||
while ((c = console_getchar()) != '\r')
|
while ((c = console_getchar()) != '\r')
|
||||||
{
|
{
|
||||||
retry:
|
retry:
|
||||||
|
if (c == 0)
|
||||||
|
continue;
|
||||||
if ( (c > 0x1f) && (c < 0x7f) && (l < length - 1) )
|
if ( (c > 0x1f) && (c < 0x7f) && (l < length - 1) )
|
||||||
{
|
{
|
||||||
for (i = l; i > pos; i--)
|
for (i = l; i > pos; i--)
|
||||||
@ -60,9 +62,11 @@ retry:
|
|||||||
else switch(c)
|
else switch(c)
|
||||||
{
|
{
|
||||||
case '':
|
case '':
|
||||||
if ( (c = console_getchar()) != '[' )
|
while ((c = console_getchar()) == 0);
|
||||||
|
if ( c != '[' )
|
||||||
goto retry;
|
goto retry;
|
||||||
switch(c = console_getchar())
|
while ((c = console_getchar()) == 0);
|
||||||
|
switch(c)
|
||||||
{
|
{
|
||||||
case 'D':
|
case 'D':
|
||||||
LEFT_ARROW();
|
LEFT_ARROW();
|
||||||
|
Loading…
Reference in New Issue
Block a user