Преглед изворни кода

Merge pull request #71 from glguy/pr-cli-history

Write whole debug cli command to history
capsense
Jacob Alexander пре 8 година
родитељ
комит
6dfeffd9ca
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7
    5
      Debug/cli/cli.c

+ 7
- 5
Debug/cli/cli.c Прегледај датотеку

@@ -159,15 +159,12 @@ void CLI_process()
}
else
{
// Only do command-related stuff if there was actually a command
// Avoids clogging command history with blanks
// Add the command to the history
CLI_saveHistory( CLILineBuffer );

// Process the current line buffer
CLI_commandLookup();

// Add the command to the history
CLI_saveHistory( CLILineBuffer );

// Keep the array circular, discarding the older entries
if ( CLIHistoryTail < CLIHistoryHead )
CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize;
@@ -425,6 +422,11 @@ inline void CLI_saveHistory( char *buff )
return;
}

// Don't write empty lines to the history
const char *cursor = buff;
while (*cursor == ' ') { cursor++; } // advance past the leading whitespace
if (*cursor == '\0') { return ; }

// Copy the line to the history
int i;
for (i = 0; i < CLILineBufferCurrent; i++)