[Orxonox-commit 2484] r7191 - code/branches/consolecommands3/src/libraries/core
landauf at orxonox.net
landauf at orxonox.net
Thu Aug 19 18:07:52 CEST 2010
Author: landauf
Date: 2010-08-19 18:07:52 +0200 (Thu, 19 Aug 2010)
New Revision: 7191
Modified:
code/branches/consolecommands3/src/libraries/core/Shell.cc
Log:
don't add repetitive or empty commands to the command history
Modified: code/branches/consolecommands3/src/libraries/core/Shell.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/Shell.cc 2010-08-19 15:48:01 UTC (rev 7190)
+++ code/branches/consolecommands3/src/libraries/core/Shell.cc 2010-08-19 16:07:52 UTC (rev 7191)
@@ -221,6 +221,13 @@
void Shell::addToHistory(const std::string& command)
{
+ if (command == "")
+ return;
+
+ size_t previous_offset = mod(this->historyOffset_ - 1, this->maxHistoryLength_);
+ if (previous_offset < this->commandHistory_.size() && command == this->commandHistory_[previous_offset])
+ return;
+
ModifyConfigValue(commandHistory_, set, this->historyOffset_, command);
this->historyPosition_ = 0;
ModifyConfigValue(historyOffset_, set, (this->historyOffset_ + 1) % this->maxHistoryLength_);
More information about the Orxonox-commit
mailing list