mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Fix bug #6237: The boundary has to be set correctly when moving up with a selection. If not, the cursor will remain on the same row when there are two e.g. displayed equations after each other. This will cause an infinite loop when SCREEN_UP is executed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31863 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d63403205b
commit
5ebc733ff3
@ -1834,31 +1834,43 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
operator=(dummy);
|
operator=(dummy);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if there is a selection, we stay out of any inset, and just jump to the right position:
|
// if there is a selection, we stay out of any inset,
|
||||||
|
// and just jump to the right position:
|
||||||
Cursor old = *this;
|
Cursor old = *this;
|
||||||
|
int next_row = row;
|
||||||
if (up) {
|
if (up) {
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
top().pos() = min(tm.x2pos(pit(), row - 1, xo), top().lastpos());
|
--next_row;
|
||||||
|
top().pos()
|
||||||
|
= min(tm.x2pos(pit(), next_row, xo), top().lastpos());
|
||||||
} else if (pit() > 0) {
|
} else if (pit() > 0) {
|
||||||
--pit();
|
--pit();
|
||||||
TextMetrics & tm = bv_->textMetrics(text());
|
TextMetrics & tm = bv_->textMetrics(text());
|
||||||
if (!tm.contains(pit()))
|
if (!tm.contains(pit()))
|
||||||
tm.newParMetricsUp();
|
tm.newParMetricsUp();
|
||||||
ParagraphMetrics const & pmcur = tm.parMetrics(pit());
|
ParagraphMetrics const & pmcur = tm.parMetrics(pit());
|
||||||
top().pos() = min(tm.x2pos(pit(), pmcur.rows().size() - 1, xo), top().lastpos());
|
next_row = pmcur.rows().size() - 1;
|
||||||
|
top().pos()
|
||||||
|
= min(tm.x2pos(pit(), next_row, xo), top().lastpos());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (row + 1 < int(pm.rows().size())) {
|
if (row + 1 < int(pm.rows().size())) {
|
||||||
top().pos() = min(tm.x2pos(pit(), row + 1, xo), top().lastpos());
|
++next_row;
|
||||||
|
top().pos()
|
||||||
|
= min(tm.x2pos(pit(), next_row, xo), top().lastpos());
|
||||||
} else if (pit() + 1 < int(text()->paragraphs().size())) {
|
} else if (pit() + 1 < int(text()->paragraphs().size())) {
|
||||||
++pit();
|
++pit();
|
||||||
TextMetrics & tm = bv_->textMetrics(text());
|
TextMetrics & tm = bv_->textMetrics(text());
|
||||||
if (!tm.contains(pit()))
|
if (!tm.contains(pit()))
|
||||||
tm.newParMetricsDown();
|
tm.newParMetricsDown();
|
||||||
top().pos() = min(tm.x2pos(pit(), 0, xo), top().lastpos());
|
next_row = 0;
|
||||||
|
top().pos()
|
||||||
|
= min(tm.x2pos(pit(), next_row, xo), top().lastpos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boundary(tm.x2pos(pit(), next_row, xo)
|
||||||
|
== tm.x2pos(pit(), next_row, tm.width()));
|
||||||
updateNeeded |= bv().checkDepm(*this, old);
|
updateNeeded |= bv().checkDepm(*this, old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user