]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Fix broken layout file syntax
[lyx.git] / src / Text3.cpp
index 5260053657a6886699cd31a424844e6636654c55..9cace0df53822176dcb873b498035eb62c2c6712 100644 (file)
@@ -2321,6 +2321,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 
        FontInfo const & fontinfo = cur.real_current_font.fontInfo();
        bool enable = true;
+       bool allow_in_passthru = false;
        InsetCode code = NO_CODE;
 
        switch (cmd.action()) {
@@ -2517,6 +2518,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                break;
        case LFUN_ARGUMENT_INSERT: {
                code = ARG_CODE;
+               allow_in_passthru = true;
                string const arg = cmd.getArg(0);
                if (arg.empty()) {
                        enable = false;
@@ -2527,8 +2529,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                Layout::LaTeXArgMap::const_iterator const lait =
                                args.find(convert<unsigned int>(arg));
                if (lait != args.end()) {
+                       enable = true;
                        InsetList::const_iterator it = cur.paragraph().insetList().begin();
-                       InsetList::const_iterator end = cur.paragraph().insetList().end();
+                       InsetList::const_iterator const end = cur.paragraph().insetList().end();
                        for (; it != end; ++it) {
                                if (it->inset->lyxCode() == ARG_CODE) {
                                        InsetArgument const * ins =
@@ -2540,7 +2543,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                                        }
                                }
                        }
-                       enable = true;
                } else
                        enable = false;
                break;
@@ -2913,7 +2915,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
        if (code != NO_CODE
            && (cur.empty() 
                || !cur.inset().insetAllowed(code)
-               || cur.paragraph().layout().pass_thru))
+               || (cur.paragraph().layout().pass_thru && !allow_in_passthru)))
                enable = false;
 
        flag.setEnabled(enable);