# HG changeset patch # User Jacob Alexander # Date 1445908000 25200 # Node ID 9ec758fc2e1f5659aabcc0531ec495bf4e0c5eb7 # Parent 0d96d2bbf225353fbbd17d1b0182d4b083b35cfa# Parent e581daa76a149995cf75061f38c56554797f0287 Merge pull request #71 from glguy/pr-cli-history Write whole debug cli command to history diff -r 0d96d2bbf225 -r 9ec758fc2e1f Debug/cli/cli.c --- a/Debug/cli/cli.c Sun Oct 18 17:54:41 2015 -0700 +++ b/Debug/cli/cli.c Mon Oct 26 18:06:40 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++)