]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
When we use InPremable styles, we want to write as many versions
[lyx.git] / src / BufferView.cpp
index 6de832dae58715af6b55b0286c882e39595b596d..a267410f2c10004db83cbf0e11945b72dd7f328b 100644 (file)
@@ -2203,7 +2203,7 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
                // inset (depending on cmd.x(), cmd.y()). This is needed for
                // editing to fix bug 9628, but e.g. the context menu needs a
                // cursor in front of the inset.
-               if (inset->hasSettings() &&
+               if ((inset->hasSettings() || !inset->contextMenuName().empty()) &&
                    cur.nextInset() != inset && cur.prevInset() == inset)
                        cur.posBackward();
        }
@@ -2225,8 +2225,6 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
        if (!inset || !cur.result().dispatched())
                cur.dispatch(cmd);
 
-       cur.endUndoGroup();
-
        // Notify left insets
        if (cur != old) {
                bool badcursor = old.fixIfBroken() | cur.fixIfBroken();
@@ -2235,6 +2233,8 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
                        cursor().fixIfBroken();
        }
 
+       cur.endUndoGroup();
+
        // Do we have a selection?
        theSelection().haveSelection(cursor().selection());
 
@@ -2514,7 +2514,8 @@ bool BufferView::mouseSetCursor(Cursor & cur, bool select)
        bool update = leftinset;
        if (!do_selection && d->cursor_.inTexted()) {
                update |= checkDepm(cur, d->cursor_);
-               if (cur.pos() && cur.paragraph().isEnvSeparator(cur.pos() - 1))
+               if (cur.inTexted() && cur.pos()
+                       && cur.paragraph().isEnvSeparator(cur.pos() - 1))
                    cur.posBackward();
        }