From cca605d8b4ae0fe8826b7ed30f73f3ceface2b81 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 17 Jun 2014 17:21:30 -0400 Subject: [PATCH] Prevent blank lines from being stored in history --- plugins/command-prompt.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 44f55b5e0..f9a3f80bf 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -58,6 +58,14 @@ public: cursor_pos = 0; frame = 0; history_idx = command_history.size(); + if (history_idx > 0) + { + if (command_history[history_idx - 1] == "") + { + command_history.pop_back(); + history_idx--; + } + } command_history.push_back(entry); } ~viewscreen_commandpromptst() @@ -205,6 +213,8 @@ void viewscreen_commandpromptst::feed(std::set *events) parent->feed(events); events->clear(); } + //if (command_history.size() && !entry.size()) + // command_history.pop_back(); return; } if (events->count(interface_key::SELECT))