Text2.cpp (checkAndActivateInset, checkAndActivateInsetVisual): activate insets on selection if the anchor is inside the inset.

insets/InsetText.cpp (InsetText::edit): do not reset the selection
Fixes #2346.
This commit is contained in:
Alfredo Braunstein 2014-10-12 10:07:18 +02:00
parent ec269c2000
commit 25cf12d650
2 changed files with 4 additions and 5 deletions

View 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;

View 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();
}