Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7191 for code


Ignore:
Timestamp:
Aug 19, 2010, 6:07:52 PM (14 years ago)
Author:
landauf
Message:

don't add repetitive or empty commands to the command history

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/Shell.cc

    r7189 r7191  
    222222    void Shell::addToHistory(const std::string& command)
    223223    {
     224        if (command == "")
     225            return;
     226
     227        size_t previous_offset = mod(this->historyOffset_ - 1, this->maxHistoryLength_);
     228        if (previous_offset < this->commandHistory_.size() && command == this->commandHistory_[previous_offset])
     229            return;
     230
    224231        ModifyConfigValue(commandHistory_, set, this->historyOffset_, command);
    225232        this->historyPosition_ = 0;
Note: See TracChangeset for help on using the changeset viewer.