]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Shortcut for LyX HTML output. (Makes my life easier!)
[lyx.git] / src / Cursor.cpp
index b652c035ef66901bde3a892ebf8b4e121b637717..14e31f922cd4731c8b8820f6c8379df5907b8400 100644 (file)
@@ -1301,7 +1301,7 @@ void Cursor::insert(Inset * inset0)
 
 void Cursor::niceInsert(docstring const & t, Parse::flags f)
 {
-       MathData ar;
+       MathData ar(buffer());
        asArray(t, ar, f);
        if (ar.size() == 1)
                niceInsert(ar[0]);
@@ -1322,7 +1322,7 @@ void Cursor::niceInsert(MathAtom const & t)
                // push the clone, not the original
                pushBackward(*nextInset());
                // We may not use niceInsert here (recursion)
-               MathData ar;
+               MathData ar(buffer());
                asArray(safe, ar);
                insert(ar);
        }
@@ -1473,7 +1473,7 @@ bool Cursor::macroModeClose()
                return false;
        InsetMathUnknown * p = activeMacro();
        p->finalize();
-       MathData selection;
+       MathData selection(buffer());
        asArray(p->selection(), selection);
        docstring const s = p->name();
        --pos();
@@ -1914,8 +1914,16 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                }
                top().pos() = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
 
-               boundary(tm.x2pos(pit(), next_row, xo) 
-                       == tm.x2pos(pit(), next_row, tm.width()));
+               int const xpos = tm.x2pos(pit(), next_row, xo);
+               bool const at_end_row = xpos == tm.x2pos(pit(), next_row, tm.width());
+               bool const at_beg_row = xpos == tm.x2pos(pit(), next_row, 0);
+
+               if (at_end_row && at_beg_row)
+                       // make sure the cursor ends up on this row
+                       boundary(false);
+               else
+                       boundary(at_end_row);
+
                updateNeeded |= bv().checkDepm(*this, old);
        }