mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
branch: 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.
(I added a small extra safety measure to not change the logic resulting from r31864. I'm not sure it can harm.) see r31863, r31864. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@31880 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
59cfb45de0
commit
f38483d441
@ -1859,31 +1859,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;
|
||||||
|
bool update = false;
|
||||||
if (up) {
|
if (up) {
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
top().pos() = min(tm.x2pos(pit(), row - 1, xo), top().lastpos());
|
--next_row;
|
||||||
|
update = true;
|
||||||
} 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;
|
||||||
|
update = true;
|
||||||
}
|
}
|
||||||
} 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;
|
||||||
|
update = true;
|
||||||
} 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;
|
||||||
|
update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (update) {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,9 @@ What's new
|
|||||||
|
|
||||||
- Fix a crash when leaving an empty superscript or subscript (bug 6193).
|
- Fix a crash when leaving an empty superscript or subscript (bug 6193).
|
||||||
|
|
||||||
|
- Fix an infinite loop when selecting multiple displayed equation right
|
||||||
|
after each other with LFUN_SCREEN_UP (bug 6237).
|
||||||
|
|
||||||
- Fix a number of assertions when displaying error messages (bug 6205).
|
- Fix a number of assertions when displaying error messages (bug 6205).
|
||||||
|
|
||||||
- Fix bad allocation exception when displaying long tooltips (bug 6215).
|
- Fix bad allocation exception when displaying long tooltips (bug 6215).
|
||||||
|
Loading…
Reference in New Issue
Block a user