Make setCursorToAnchor set the cursor to the normalized selection anchor in stead of the real anchor.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32790 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-01-06 16:59:12 +00:00
parent fe75690c03
commit 742ee134a4
2 changed files with 9 additions and 3 deletions

View File

@ -483,8 +483,14 @@ void Cursor::resetAnchor()
void Cursor::setCursorToAnchor()
{
if (selection())
setCursor(anchor_);
if (selection()) {
DocIterator normal = anchor_;
while (depth() < normal.depth())
normal.pop_back();
if (depth() < anchor_.depth() && top() <= anchor_[depth() - 1])
++normal.pos();
setCursor(normal);
}
}

View File

@ -65,7 +65,7 @@ public:
void leaveInset(Inset const & inset);
/// sets cursor part
void setCursor(DocIterator const & it);
/// sets the cursor to the anchor
/// sets the cursor to the normalized selection anchor
void setCursorToAnchor();
///