CLI: update historyPrevius()
This commit is contained in:
parent
8f8000d9ca
commit
73c0013ee9
@ -119,6 +119,11 @@ void historyPrevius()
|
||||
// add current text to end of history
|
||||
line = fifoToString(FIFO);
|
||||
History_put(History, line);
|
||||
for (int i=0; *(line + i) != '\0'; i++)
|
||||
{
|
||||
CLI_stringOut((char*)"\x1b[D \x1b[D");
|
||||
}
|
||||
History_getPrev(History, &line);
|
||||
}
|
||||
|
||||
// empty current line
|
||||
@ -267,9 +272,9 @@ bool CLI_charIn(char c)
|
||||
{
|
||||
#ifdef HISTORY
|
||||
case 'A': // arrow up
|
||||
CLI_State = CLI_State_Default;
|
||||
historyPrevius();
|
||||
// CLI_stringOut((char*)"(key: arrow up)");
|
||||
CLI_State = CLI_State_Default;
|
||||
break;
|
||||
case 'B': // arrow down
|
||||
// history next
|
||||
|
||||
@ -100,10 +100,14 @@ int History_getPrev(History_t* history, char** line)
|
||||
{
|
||||
history->CurrEl_p = history->LastEl_p;
|
||||
}
|
||||
else
|
||||
else if (history->CurrEl_p->prevEl_p != NULL)
|
||||
{
|
||||
history->CurrEl_p = history->CurrEl_p->prevEl_p;
|
||||
}
|
||||
else
|
||||
{ // no previus line
|
||||
retCode = -2;
|
||||
}
|
||||
|
||||
if (history->CurrEl_p != NULL)
|
||||
{
|
||||
@ -111,7 +115,7 @@ int History_getPrev(History_t* history, char** line)
|
||||
retCode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
{ // no items in history?
|
||||
*line = NULL;
|
||||
retCode = -1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user