]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetCommandParams.cpp
Completion: handle undo in insets' insertCompletion methods
[features.git] / src / insets / InsetCommandParams.cpp
index 1f7d32110810fe3e18ed6aee8680e75c4dac11d0..09c9ee85a0926b279c396cec0040a97eecda13e2 100644 (file)
@@ -5,15 +5,12 @@
  *
  * \author Angus Leeming
  * \author Georg Baum
- * \author Richard Heck
+ * \author Richard Kimberly Heck
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
-#include <algorithm>
-#include <functional>
-
 
 #include "InsetCommandParams.h"
 
@@ -34,7 +31,6 @@
 #include "Buffer.h"
 #include "Encoding.h"
 #include "Lexer.h"
-#include "OutputParams.h"
 
 #include "frontends/alert.h"
 
@@ -46,6 +42,9 @@
 
 #include "support/lassert.h"
 
+#include <algorithm>
+#include <functional>
+
 using namespace std;
 using namespace lyx::support;
 
@@ -501,8 +500,7 @@ docstring InsetCommandParams::prepareCommand(OutputParams const & runparams,
                // we can only output characters covered by the current
                // encoding!
                docstring uncodable;
-               for (size_type i = 0 ; i < command.size() ; ++i) {
-                       char_type c = command[i];
+               for (char_type c : command) {
                        try {
                                if (runparams.encoding->encodable(c))
                                        result += c;
@@ -600,7 +598,7 @@ docstring InsetCommandParams::getFirstNonOptParam() const
 {
        ParamInfo::const_iterator it =
                find_if(info_.begin(), info_.end(),
-                       not1(mem_fun_ref(&ParamInfo::ParamData::isOptional)));
+                       [](ParamInfo::ParamData const & d) { return !d.isOptional(); });
        LASSERT(it != info_.end(), return docstring());
        return (*this)[it->name()];
 }