mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 19:14:51 +00:00
fix cursor movements.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16638 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e0a7b67497
commit
31cbae750d
@ -1238,6 +1238,8 @@ void BufferView::setCursor(DocIterator const & dit)
|
|||||||
dit[i].inset().edit(cursor_, true);
|
dit[i].inset().edit(cursor_, true);
|
||||||
|
|
||||||
cursor_.setCursor(dit);
|
cursor_.setCursor(dit);
|
||||||
|
// remember new position.
|
||||||
|
cursor_.setTargetX();
|
||||||
cursor_.selection() = false;
|
cursor_.selection() = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1281,6 +1283,7 @@ bool BufferView::mouseSetCursor(LCursor & cur)
|
|||||||
|
|
||||||
cursor_ = cur;
|
cursor_ = cur;
|
||||||
cursor_.clearSelection();
|
cursor_.clearSelection();
|
||||||
|
// remember new position.
|
||||||
cursor_.setTargetX();
|
cursor_.setTargetX();
|
||||||
finishUndo();
|
finishUndo();
|
||||||
return update;
|
return update;
|
||||||
|
@ -1724,6 +1724,8 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
setCursor(cur, pit, pos, true, bound);
|
setCursor(cur, pit, pos, true, bound);
|
||||||
|
// remember new position.
|
||||||
|
cur.setTargetX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
14
src/text2.C
14
src/text2.C
@ -985,13 +985,16 @@ bool LyXText::cursorUp(LCursor & cur)
|
|||||||
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
|
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
|
||||||
|
|
||||||
int row;
|
int row;
|
||||||
int const x = cur.targetX();
|
|
||||||
|
|
||||||
if (cur.pos() && cur.boundary())
|
if (cur.pos() && cur.boundary())
|
||||||
row = pm.pos2row(cur.pos()-1);
|
row = pm.pos2row(cur.pos()-1);
|
||||||
else
|
else
|
||||||
row = pm.pos2row(cur.pos());
|
row = pm.pos2row(cur.pos());
|
||||||
|
|
||||||
|
// remember current position only if we are not at the end of a row.
|
||||||
|
if (cur.pos() != pm.rows()[row].endpos())
|
||||||
|
cur.setTargetX();
|
||||||
|
int const x = cur.targetX();
|
||||||
|
|
||||||
if (!cur.selection()) {
|
if (!cur.selection()) {
|
||||||
int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;
|
int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;
|
||||||
LCursor old = cur;
|
LCursor old = cur;
|
||||||
@ -1041,13 +1044,16 @@ bool LyXText::cursorDown(LCursor & cur)
|
|||||||
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
|
ParagraphMetrics const & pm = tm.parMetrics(cur.pit());
|
||||||
|
|
||||||
int row;
|
int row;
|
||||||
int const x = cur.targetX();
|
|
||||||
|
|
||||||
if (cur.pos() && cur.boundary())
|
if (cur.pos() && cur.boundary())
|
||||||
row = pm.pos2row(cur.pos()-1);
|
row = pm.pos2row(cur.pos()-1);
|
||||||
else
|
else
|
||||||
row = pm.pos2row(cur.pos());
|
row = pm.pos2row(cur.pos());
|
||||||
|
|
||||||
|
// remember current position only if we are not at the end of a row.
|
||||||
|
if (cur.pos() != pm.rows()[row].endpos())
|
||||||
|
cur.setTargetX();
|
||||||
|
int const x = cur.targetX();
|
||||||
|
|
||||||
if (!cur.selection()) {
|
if (!cur.selection()) {
|
||||||
int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;
|
int const y = bv_funcs::getPos(cur.bv(), cur, cur.boundary()).y_;
|
||||||
LCursor old = cur;
|
LCursor old = cur;
|
||||||
|
Loading…
Reference in New Issue
Block a user