From 26821d1a790a7aa6805378044a0611074d9cccf3 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Mon, 8 Aug 2016 08:01:52 +0200 Subject: [PATCH] Don't add empty lines to libedit's history refs #12234 --- lib/cli/consolecommand.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 5da45da65..005ea9e19 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -268,14 +268,12 @@ incomplete: if (!cline) break; - if (commandOnce.IsEmpty()) { + if (commandOnce.IsEmpty() && cline[0] != '\0') { add_history(cline); - if (cline[0] != '\0') { - historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); - historyfp << cline << "\n"; - historyfp.close(); - } + historyfp.open(historyPath.CStr(), std::fstream::out | std::fstream::app); + historyfp << cline << "\n"; + historyfp.close(); } line = cline;