Mercurial > louis > kiibohd-controller
changeset 395:e581daa76a14
Write whole debug cli command to history
Previously the command was being modified in place in order
to find the command name. This was happening before saving
to the history.
Fixes #70
author | Eric Mertens <emertens@gmail.com> |
---|---|
date | Mon, 26 Oct 2015 17:55:41 -0700 |
parents | 0d96d2bbf225 |
children | 9ec758fc2e1f |
files | Debug/cli/cli.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Debug/cli/cli.c Sun Oct 18 17:54:41 2015 -0700 +++ b/Debug/cli/cli.c Mon Oct 26 17:55:41 2015 -0700 @@ -159,15 +159,12 @@ } 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 @@ 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++)