]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / mathed / InsetMathNest.cpp
index 473457d71ca016bd8568d1f0b43a24faf96e90b8..d1c413b620bcb6fcf072a10183c8001fcab30ac1 100644 (file)
@@ -50,6 +50,7 @@
 #include "FuncStatus.h"
 #include "LyX.h"
 #include "LyXRC.h"
+#include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "Text.h"
 
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
 
-#include "support/lassert.h"
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/textutils.h"
-#include "support/docstream.h"
 
 #include <algorithm>
 #include <sstream>
@@ -379,9 +380,8 @@ void InsetMathNest::write(WriteStream & os) const
        docstring const latex_name = name();
        os << '\\' << latex_name;
        for (size_t i = 0; i < nargs(); ++i) {
-               os.pushRowEntry(TexRow::mathEntry(id(),i));
+               Changer dummy = os.changeRowEntry(TexRow::mathEntry(id(),i));
                os << '{' << cell(i) << '}';
-               os.popRowEntry();
        }
        if (nargs() == 0)
                os.pendingSpace(true);
@@ -407,13 +407,9 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
                        runparams.dryrun ? WriteStream::wsDryrun : WriteStream::wsDefault,
                        runparams.encoding);
        wi.canBreakLine(os.canBreakLine());
-       if (runparams.lastid != -1) {
-               wi.pushRowEntry(os.texrow().textEntry(runparams.lastid,
-                                                                                         runparams.lastpos));
-               write(wi);
-               wi.popRowEntry();
-       } else
-               write(wi);
+       Changer dummy = wi.changeRowEntry(os.texrow().textEntry(runparams.lastid,
+                                                               runparams.lastpos));
+       write(wi);
        // Reset parbreak status after a math inset.
        os.lastChar(0);
        os.canBreakLine(wi.canBreakLine());
@@ -715,8 +711,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.selHandle(select);
 
                // handle autocorrect:
-               cur.autocorrect() = false;
-               cur.message(_("Autocorrect Off ('!' to enter)"));
+               if (lyxrc.autocorrection_math && cur.autocorrect()) {
+                       cur.autocorrect() = false;
+                       cur.message(_("Autocorrect Off ('!' to enter)"));
+               }
 
                // go up/down
                bool up = act == LFUN_UP || act == LFUN_UP_SELECT;
@@ -735,12 +733,19 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
        }
 
        case LFUN_MOUSE_DOUBLE:
-       case LFUN_MOUSE_TRIPLE:
        case LFUN_WORD_SELECT:
                cur.pos() = 0;
+               cur.resetAnchor();
+               cur.selection(true);
+               cur.pos() = cur.lastpos();
+               cur.bv().cursor() = cur;
+               break;
+
+       case LFUN_MOUSE_TRIPLE:
                cur.idx() = 0;
+               cur.pos() = 0;
                cur.resetAnchor();
-               cur.setSelection(true);
+               cur.selection(true);
                cur.idx() = cur.lastidx();
                cur.pos() = cur.lastpos();
                cur.bv().cursor() = cur;
@@ -1612,7 +1617,7 @@ void InsetMathNest::lfunMouseRelease(Cursor & cur, FuncRequest & cmd)
                        cur.noScreenUpdate();
                else {
                        Cursor & bvcur = cur.bv().cursor();
-                       bvcur.setSelection(true);
+                       bvcur.selection(true);
                }
                return;
        }
@@ -1753,7 +1758,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
 
        // just clear selection on pressing the space bar
        if (cur.selection() && c == ' ') {
-               cur.setSelection(false);
+               cur.selection(false);
                return true;
        }
 
@@ -2164,6 +2169,7 @@ MathCompletionList::MathCompletionList(Cursor const & cur)
        globals.push_back(from_ascii("\\sqrt"));
        globals.push_back(from_ascii("\\root"));
        globals.push_back(from_ascii("\\tabular"));
+       globals.push_back(from_ascii("\\sideset"));
        globals.push_back(from_ascii("\\stackrel"));
        globals.push_back(from_ascii("\\stackrelthree"));
        globals.push_back(from_ascii("\\binom"));