sh: Do not backspace if command is empty
This commit is contained in:
parent
b69fbd46bf
commit
0720b3245b
@ -139,11 +139,33 @@ void command_concat(command* cmd, const char* str)
|
||||
{
|
||||
while (*str)
|
||||
{
|
||||
putchar(*str);
|
||||
if (*str == '\b') { command_pop(cmd); }
|
||||
else if (*str == '\n') { command_execute(cmd); }
|
||||
if (*str == '\b')
|
||||
{
|
||||
if (cmd->size == 0)
|
||||
{
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
putchar(*str);
|
||||
command_pop(cmd);
|
||||
}
|
||||
else if (*str == '\n')
|
||||
{
|
||||
if (cmd->size == 0)
|
||||
{
|
||||
putchar(*str);
|
||||
show_prompt();
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
putchar(*str);
|
||||
command_execute(cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
putchar(*str);
|
||||
command_push(cmd, *str);
|
||||
}
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user