瀏覽代碼

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 查看文件

} }
else 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 // Process the current line buffer
CLI_commandLookup(); CLI_commandLookup();


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

// Keep the array circular, discarding the older entries // Keep the array circular, discarding the older entries
if ( CLIHistoryTail < CLIHistoryHead ) if ( CLIHistoryTail < CLIHistoryHead )
CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize; CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize;
return; 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 // Copy the line to the history
int i; int i;
for (i = 0; i < CLILineBufferCurrent; i++) for (i = 0; i < CLILineBufferCurrent; i++)