commit 92742f63bc649aa6574a6f068962f244ef761656
Author: Richard Heck <rgh...@lyx.org>
Date:   Sat Feb 24 00:20:03 2018 -0500

    Fix bug #10926, and some for loops.
---
 src/Text3.cpp |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index d811616..84395ad 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -106,9 +106,9 @@ static Font freefont(ignore_font, ignore_language);
 static bool toggleall = false;
 
 static void toggleAndShow(Cursor & cur, Text * text,
-       Font const & font, bool toggleall = true)
+       Font const & font, bool togall = true)
 {
-       text->toggleFree(cur, font, toggleall);
+       text->toggleFree(cur, font, togall);
 
        if (font.language() != ignore_language ||
            font.fontInfo().number() != FONT_IGNORE) {
@@ -1092,8 +1092,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                } else {
                        // Maybe we shouldn't allow tabs within a line, because 
they
                        // are not (yet) aligned as one might do expect.
-                       FuncRequest cmd(LFUN_SELF_INSERT, from_ascii("\t"));
-                       dispatch(cur, cmd);
+                       FuncRequest ncmd(LFUN_SELF_INSERT, from_ascii("\t"));
+                       dispatch(cur, ncmd);
                }
                break;
        }
@@ -1239,13 +1239,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                // If we have a list and autoinsert item insets,
                // insert them now.
                Layout::LaTeXArgMap args = par.layout().args();
-               Layout::LaTeXArgMap::const_iterator lait = args.begin();
-               Layout::LaTeXArgMap::const_iterator const laend = args.end();
-               for (; lait != laend; ++lait) {
-                       Layout::latexarg arg = (*lait).second;
-                       if (arg.autoinsert && prefixIs((*lait).first, "item:")) 
{
-                               FuncRequest cmd(LFUN_ARGUMENT_INSERT, 
(*lait).first);
-                               lyx::dispatch(cmd);
+               for (auto const & thearg : args) {
+                       Layout::latexarg arg = thearg.second;
+                       if (arg.autoinsert && prefixIs(thearg.first, "item:")) {
+                               FuncRequest cmd2(LFUN_ARGUMENT_INSERT, 
thearg.first);
+                               lyx::dispatch(cmd2);
                        }
                }
                break;
@@ -1584,8 +1582,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                for (; lait != laend; ++lait) {
                        Layout::latexarg arg = (*lait).second;
                        if (arg.autoinsert) {
-                               FuncRequest cmd(LFUN_ARGUMENT_INSERT, 
(*lait).first);
-                               lyx::dispatch(cmd);
+                               FuncRequest cmd2(LFUN_ARGUMENT_INSERT, 
(*lait).first);
+                               lyx::dispatch(cmd2);
                        }
                }
 
@@ -2070,8 +2068,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        if (arg.autoinsert) {
                                // The cursor might have been invalidated by 
the replaceSelection.
                                cur.buffer()->changed(true);
-                               FuncRequest cmd(LFUN_ARGUMENT_INSERT, 
(*lait).first);
-                               lyx::dispatch(cmd);
+                               FuncRequest cmd2(LFUN_ARGUMENT_INSERT, 
(*lait).first);
+                               lyx::dispatch(cmd2);
                                autoargs = true;
                        }
                }

Reply via email to