From 8a2413b5c03390a5f615ede487172c3168d9cff3 Mon Sep 17 00:00:00 2001 From: Michael 'ASAP' Weinrich Date: Sun, 15 Mar 2020 21:09:46 -0700 Subject: [PATCH] Added filtering blank lines from history --- examples/system/console/main/console_example_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/system/console/main/console_example_main.c b/examples/system/console/main/console_example_main.c index 697a0345a8..0292b7fd72 100644 --- a/examples/system/console/main/console_example_main.c +++ b/examples/system/console/main/console_example_main.c @@ -173,12 +173,14 @@ void app_main(void) if (line == NULL) { /* Break on EOF or error */ break; } - /* Add the command to the history */ - linenoiseHistoryAdd(line); + /* Add the command to the history if not empty*/ + if(strlen(line) > 0) { + linenoiseHistoryAdd(line); #if CONFIG_STORE_HISTORY - /* Save command history to filesystem */ - linenoiseHistorySave(HISTORY_PATH); + /* Save command history to filesystem */ + linenoiseHistorySave(HISTORY_PATH); #endif + } /* Try to run the command */ int ret;