]> git.lyx.org Git - features.git/blobdiff - src/Session.cpp
Introduce index-tag-all lfun
[features.git] / src / Session.cpp
index a814991e59dcbdfdb709931f881c313f1dad3672..d79a5a09a94a8874c699e312d89321e0f5acf156 100644 (file)
@@ -408,6 +408,11 @@ void LastCommandsSection::setNumberOfLastCommands(unsigned int no)
 
 void LastCommandsSection::add(std::string const & command)
 {
+       // remove traces of 'command' in history using the erase-remove idiom
+       //   https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom
+       lastcommands.erase(remove(lastcommands.begin(), lastcommands.end(), command),
+                          lastcommands.end());
+       // add it at the end of the list.
        lastcommands.push_back(command);
 }