]> git.lyx.org Git - features.git/commitdiff
Text2.cpp (checkAndActivateInset, checkAndActivateInsetVisual): activate insets on...
authorAlfredo Braunstein <abraunst@lyx.org>
Sun, 12 Oct 2014 08:07:18 +0000 (10:07 +0200)
committerAlfredo Braunstein <abraunst@lyx.org>
Sun, 12 Oct 2014 08:07:18 +0000 (10:07 +0200)
insets/InsetText.cpp (InsetText::edit): do not reset the selection
Fixes #2346.

src/Text2.cpp
src/insets/InsetText.cpp

index d1c34c89536038a92850b92f5563493d01e935c9..9f247a55435ff951b38245dcb26b21e15843ee8e 100644 (file)
@@ -592,8 +592,6 @@ void Text::setCursorIntern(Cursor & cur,
 
 bool Text::checkAndActivateInset(Cursor & cur, bool front)
 {
-       if (cur.selection())
-               return false;
        if (front && cur.pos() == cur.lastpos())
                return false;
        if (!front && cur.pos() == 0)
@@ -601,6 +599,8 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front)
        Inset * inset = front ? cur.nextInset() : cur.prevInset();
        if (!inset || !inset->editable())
                return false;
+       if (cur.selection() && cur.realAnchor().find(inset) == -1)
+               return false;
        /*
         * Apparently, when entering an inset we are expected to be positioned
         * *before* it in the containing paragraph, regardless of the direction
@@ -617,8 +617,6 @@ bool Text::checkAndActivateInset(Cursor & cur, bool front)
 
 bool Text::checkAndActivateInsetVisual(Cursor & cur, bool movingForward, bool movingLeft)
 {
-       if (cur.selection())
-               return false;
        if (cur.pos() == -1)
                return false;
        if (cur.pos() == cur.lastpos())
@@ -627,6 +625,8 @@ bool Text::checkAndActivateInsetVisual(Cursor & cur, bool movingForward, bool mo
        Inset * inset = par.isInset(cur.pos()) ? par.getInset(cur.pos()) : 0;
        if (!inset || !inset->editable())
                return false;
+       if (cur.selection() && cur.realAnchor().find(inset) == -1)
+               return false;
        inset->edit(cur, movingForward, 
                movingLeft ? Inset::ENTRY_DIRECTION_RIGHT : Inset::ENTRY_DIRECTION_LEFT);
        return true;
index 609de704a1dae49f0d2b810d0a459c395950cbfd..de251e770b0a397e9916c909444b7189668392d9 100644 (file)
@@ -251,7 +251,6 @@ void InsetText::edit(Cursor & cur, bool front, EntryDirection entry_from)
        }
 
        text_.setCursor(cur.top(), pit, pos);
-       cur.clearSelection();
        cur.finishUndo();
 }