]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.cpp
Fix #10863 compiler warnings.
[lyx.git] / src / mathed / InsetMathHull.cpp
index 01501929c642f5b3d5078a715292cfd3f5ecc46a..724c11574ea08860a7ccef2b34a51a28f10948a3 100644 (file)
@@ -126,14 +126,14 @@ namespace {
                if (os.strikeoutMath()) {
                        if (os.ulemCmd() == WriteStream::UNDERLINE)
                                os << "\\raisebox{-\\belowdisplayshortskip}{"
-                                     "\\lyxmathsout{\\parbox[b]{\\columnwidth}{";
+                                     "\\lyxmathsout{\\parbox[b]{\\linewidth}{";
                        else
-                               os << "\\lyxmathsout{\\parbox{\\columnwidth}{";
+                               os << "\\lyxmathsout{\\parbox{\\linewidth}{";
                } else if (os.ulemCmd() == WriteStream::UNDERLINE)
                        os << "\\raisebox{-\\belowdisplayshortskip}{"
-                             "\\parbox[b]{\\columnwidth}{";
+                             "\\parbox[b]{\\linewidth}{";
                else if (os.ulemCmd() == WriteStream::STRIKEOUT)
-                       os << "\\parbox{\\columnwidth}{";
+                       os << "\\parbox{\\linewidth}{";
        }
 
 
@@ -823,11 +823,9 @@ void InsetMathHull::preparePreview(DocIterator const & pos,
        for (idx_type idx = 0; idx < nargs(); ++idx)
                usedMacros(cell(idx), pos, macros, defs);
 
-       MacroNameSet::iterator it = defs.begin();
-       MacroNameSet::iterator end = defs.end();
        docstring macro_preamble;
-       for (; it != end; ++it)
-               macro_preamble.append(*it);
+       for (auto const & defit : defs)
+               macro_preamble.append(defit);
 
        // set the font series and size for this snippet
        DocIterator dit = pos.getInnerText();
@@ -1026,7 +1024,7 @@ int InsetMathHull::indent(BufferView const & bv) const
 {
        // FIXME: set this in the textclass. This value is what the article class uses.
        static Length default_indent(2.5, Length::EM);
-       if (buffer().params().is_math_indent) {
+       if (display() != Inline && buffer().params().is_math_indent) {
                Length const & len = buffer().params().getMathIndent();
                if (len.empty())
                        return bv.inPixels(default_indent);
@@ -1650,7 +1648,8 @@ void InsetMathHull::mutate(HullType newtype)
 
        default:
                // we passed the guard so we should not be here
-               LASSERT("Mutation not implemented, but should have been.", return);
+               LYXERR0("Mutation not implemented, but should have been.");
+               LASSERT(false, return);
                break;
        }// switch
 }
@@ -2084,11 +2083,10 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
 
        case LFUN_LABEL_COPY_AS_REFERENCE: {
                bool enabled = false;
-               row_type row;
                if (cmd.argument().empty() && &cur.inset() == this) {
                        // if there is no argument and we're inside math, we retrieve
                        // the row number from the cursor position.
-                       row = (type_ == hullMultline) ? nrows() - 1 : cur.row();
+                       row_type row = (type_ == hullMultline) ? nrows() - 1 : cur.row();
                        enabled = numberedType() && label_[row] && numbered(row);
                } else {
                        // if there is an argument, find the corresponding label, else
@@ -2243,42 +2241,6 @@ void InsetMathHull::edit(Cursor & cur, bool front, EntryDirection entry_from)
 }
 
 
-void InsetMathHull::revealCodes(Cursor & cur) const
-{
-       if (!cur.inMathed())
-               return;
-       odocstringstream os;
-       cur.info(os);
-       cur.message(os.str());
-/*
-       // write something to the minibuffer
-       // translate to latex
-       cur.markInsert(bv);
-       ostringstream os;
-       write(os);
-       string str = os.str();
-       cur.markErase(bv);
-       string::size_type pos = 0;
-       string res;
-       for (string::iterator it = str.begin(); it != str.end(); ++it) {
-               if (*it == '\n')
-                       res += ' ';
-               else if (*it == '\0') {
-                       res += "  -X-  ";
-                       pos = it - str.begin();
-               }
-               else
-                       res += *it;
-       }
-       if (pos > 30)
-               res = res.substr(pos - 30);
-       if (res.size() > 60)
-               res = res.substr(0, 60);
-       cur.message(res);
-*/
-}
-
-
 /////////////////////////////////////////////////////////////////////
 
 
@@ -2355,8 +2317,8 @@ bool InsetMathHull::readQuiet(Lexer & lex)
 int InsetMathHull::plaintext(odocstringstream & os,
         OutputParams const & op, size_t max_length) const
 {
-       // disables ASCII-art for export of equations. See #2275.
-       if (0 && display()) {
+       // Try enabling this now that there is a flag as requested at #2275.
+       if (buffer().isExporting() && display()) {
                Dimension dim;
                TextMetricsInfo mi;
                metricsT(mi, dim);