Fix bug #8837: LyX hangs on selection

The code that checks whether the cursor was at the end of a row in
Cursor::upDowninText was not able to set boundary correctly. This
causes a hang in because the cursor got stuck on a line and there is an
infinite loop BufferView::dispatch when trying to go down.

The fix is to avoid using the watered-down TextMetrics::x2pos wrapper
around getColumnNearX and use the real thing instead.

Eventually, the last user of x2pos (InsetTabular) should be fixed and
the method should go away.
This commit is contained in:
Jean-Marc Lasgouttes 2014-03-17 11:15:42 +01:00
parent f5940d5e18
commit e72b3f8e3e
2 changed files with 11 additions and 12 deletions

View File

@ -2024,17 +2024,13 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
next_row = 0;
}
}
top().pos() = min(tm.x2pos(pit(), next_row, xo), top().lastpos());
int const xpos = tm.x2pos(pit(), next_row, xo);
bool const at_end_row = xpos == tm.x2pos(pit(), next_row, tm.width());
bool const at_beg_row = xpos == tm.x2pos(pit(), next_row, 0);
if (at_end_row && at_beg_row)
// make sure the cursor ends up on this row
boundary(false);
else
boundary(at_end_row);
Row const & real_next_row = tm.parMetrics(pit()).rows()[next_row];
bool bound = false;
pos_type const col = tm.getColumnNearX(pit(), real_next_row,
xo, bound);
top().pos() = real_next_row.pos() + col;
boundary(bound);
updateNeeded |= bv().checkDepm(*this, old);
}

View File

@ -83,12 +83,15 @@ What's new
- Fix crash when navigating to next change (bug 8684).
- Fix crash when optional argument inside a math macro was deleted (bug 8329).
- Fix crash when optional argument inside a math macro was deleted
(bug 8329).
- Fix hang when selecting text (bug 8837).
- Fix math-ams-matrix function that could corrupt documents if not used properly
(part of bug 8359).
- Fix problem that led to assertion in some cases when space was at beginning of
- Fix problem that led to assertion in some cases when space was at beginning of
line (bugs 8838 and 8947).
- Correctly compare documents with different author sets (bug 8769).