]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
Update Win installer for new dictionary links. Untested.
[lyx.git] / src / Cursor.cpp
index ce0281251a75850c154665de7610ae020aabc05d..0e1c3ded5558c9dd62283ad29d738fc1c15e552d 100644 (file)
@@ -714,6 +714,7 @@ bool CursorData::confirmDeletion(bool const before) const
 Cursor::Cursor(BufferView & bv)
        : CursorData(&bv.buffer()), bv_(&bv),
          x_target_(-1), textTargetOffset_(0),
+         x_clickpos_(-1), y_clickpos_(-1),
          beforeDispatchPosX_(0), beforeDispatchPosY_(0)
 {}
 
@@ -789,15 +790,15 @@ void Cursor::dispatch(FuncRequest const & cmd0)
 
        beginUndoGroup();
 
+       Inset * nextins = nextInset();
        // Is this a function that acts on inset at point?
-       if (lyxaction.funcHasFlag(cmd.action(), LyXAction::AtPoint)
-           && nextInset()) {
+       if (lyxaction.funcHasFlag(cmd.action(), LyXAction::AtPoint) && nextins) {
                disp_.dispatched(true);
                disp_.screenUpdate(Update::FitCursor | Update::Force);
                FuncRequest tmpcmd = cmd;
-               LYXERR(Debug::DEBUG, "Cursor::dispatch: (AtPoint) cmd: "
+               LYXERR(Debug::ACTION, "Cursor::dispatch: (AtPoint) cmd: "
                        << cmd0 << endl << *this);
-               nextInset()->dispatch(*this, tmpcmd);
+               nextins->dispatch(*this, tmpcmd);
                if (disp_.dispatched()) {
                        endUndoGroup();
                        return;
@@ -807,7 +808,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
        // store some values to be used inside of the handlers
        beforeDispatchCursor_ = *this;
        for (; depth(); pop(), boundary(false)) {
-               LYXERR(Debug::DEBUG, "Cursor::dispatch: cmd: "
+               LYXERR(Debug::ACTION, "Cursor::dispatch: cmd: "
                        << cmd0 << endl << *this);
 
                // In any of these cases, the cursor is invalid, and we should
@@ -829,7 +830,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
        // it completely to get a 'bomb early' behaviour in case this
        // object will be used again.
        if (!disp_.dispatched()) {
-               LYXERR(Debug::DEBUG, "RESTORING OLD CURSOR!");
+               LYXERR(Debug::ACTION, "RESTORING OLD CURSOR!");
                // We might have invalidated the cursor when removing an empty
                // paragraph while the cursor could not be moved out the inset
                // while we initially thought we could. This might happen when
@@ -1381,6 +1382,13 @@ void Cursor::updateTextTargetOffset()
 }
 
 
+void Cursor::setClickPos(int x, int y)
+{
+       x_clickpos_ = x;
+       y_clickpos_ = y;
+}
+
+
 bool Cursor::selHandle(bool selecting)
 {
        //lyxerr << "Cursor::selHandle" << endl;
@@ -1804,6 +1812,7 @@ bool Cursor::macroModeClose(bool cancel)
        bool keep_mathmode = user_macro
                || (it != words.end() && (it->second.inset == "font"
                                          || it->second.inset == "oldfont"
+                                         || it->second.inset == "textsize"
                                          || it->second.inset == "mbox"));
        bool ert_macro = !user_macro && it == words.end() && atomAsMacro;
 
@@ -1873,8 +1882,6 @@ void Cursor::pullArg()
                plainErase();
                cell().insert(pos(), ar);
                resetAnchor();
-       } else {
-               //formula()->mutateToText();
        }
 }
 
@@ -1998,6 +2005,8 @@ bool Cursor::upDownInMath(bool up)
                // try to find best position within this inset
                if (!selection())
                        setCursor(bruteFind(*this, xo, yo));
+               // FIXME : this is actually only needed for InsetMathMacro (bug #12952).
+               screenUpdateFlags(Update::SinglePar);
                return true;
        }
 
@@ -2217,7 +2226,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                        if (updateNeeded)
                                forceBufferUpdate();
                }
-               return valid_destination;
+               return false;
        }
 
        // with and without selection are handled differently