Am Sun, 10 Jul 2022 15:05:43 +0200 schrieb Jean-Marc Lasgouttes <lasgouttes.lyx....@free.fr>:
> Le 10/07/2022 à 11:46, Kornel Benko a écrit : > > While testing, using history in command buffer for some often repeated > > lyx-functions > > is often made difficult when the previous (but not now desired) command > > was repeated. > > > > Objections? > > I like it, but I would make it simpler, like > if (not already the last in history) > push(new command); > > JMarc Like this? Feel free to make it simpler. Kornel
diff --git a/src/Session.cpp b/src/Session.cpp index a814991e59..20f4d39f17 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -406,10 +406,19 @@ void LastCommandsSection::setNumberOfLastCommands(unsigned int no) } void LastCommandsSection::add(std::string const & command) { + for (int i = (int) lastcommands.size() - 2; i >=0; --i) { + if (lastcommands[i].compare(command) == 0) { + lastcommands.erase(lastcommands.begin()+i); + } + } + if (lastcommands.size() > 0) { + if (lastcommands[lastcommands.size()-1].compare(command) == 0) + return; + } lastcommands.push_back(command); } void LastCommandsSection::clear()
pgpQQeTaOBK46.pgp
Description: Digitale Signatur von OpenPGP
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel