]> git.lyx.org Git - lyx.git/blobdiff - src/Session.cpp
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / Session.cpp
index a814991e59dcbdfdb709931f881c313f1dad3672..9ec18f1d0141852646217929a47bd1563abb2f62 100644 (file)
@@ -31,11 +31,12 @@ string const sec_lastfiles = "[recent files]";
 string const sec_lastfilepos = "[cursor positions]";
 string const sec_lastopened = "[last opened files]";
 string const sec_bookmarks = "[bookmarks]";
-string const sec_session = "[session info]";
-string const sec_toolbars = "[toolbars]";
 string const sec_lastcommands = "[last commands]";
 string const sec_authfiles = "[auth files]";
 string const sec_shellescape = "[shell escape files]";
+// currently unused:
+//string const sec_session = "[session info]";
+//string const sec_toolbars = "[toolbars]";
 
 } // namespace
 
@@ -408,6 +409,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);
 }