fix two crashes related to dEPM. Some crashes remain

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10551 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-10-13 14:48:27 +00:00
parent a7714398d9
commit 20af9e8555
5 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,14 @@
2005-10-07 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (setCursorFromCoordinates): return a bool telling whether
dEPM triggered.
* text3.C (cursorPrevious): update if needed after
setCursorFromCoordinates (when dEPM triggered).
* text2.C (cursorDown, cursorUp): make sure to reset the anchor
(otherwise the anchor may be completely wrong and make dEPM assert).
2005-10-12 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* buffer.C: version upgrade to 245.

View File

@ -176,8 +176,8 @@ public:
void recUndo(pit_type first, pit_type last) const;
///
void recUndo(pit_type first) const;
///
void setCursorFromCoordinates(LCursor & cur, int x, int y);
/// returns true if par was empty and was removed
bool setCursorFromCoordinates(LCursor & cur, int x, int y);
///
InsetBase * editXY(LCursor & cur, int x, int y);
/// Move cursor one line up.

View File

@ -2315,7 +2315,7 @@ pos_type LyXText::x2pos(pit_type pit, int row, int x) const
// x,y are screen coordinates
// sets cursor only within this LyXText
void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
bool LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
{
pit_type pit = getPitNearY(y);
int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent();
@ -2354,5 +2354,5 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int const x, int const y)
<< " pos: " << pos
<< endl;
setCursor(cur, pit, pos, true, bound);
return setCursor(cur, pit, pos, true, bound);
}

View File

@ -1056,6 +1056,7 @@ bool LyXText::cursorUp(LCursor & cur)
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
editXY(cur, x, y - par.rows()[row].ascent() - 1);
cur.clearSelection();
// This happens when you move out of an inset.
// And to give the DEPM the possibility of doing
@ -1101,6 +1102,7 @@ bool LyXText::cursorDown(LCursor & cur)
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
editXY(cur, x, y + par.rows()[row].descent() + 1);
cur.clearSelection();
// This happens when you move out of an inset.
// And to give the DEPM the possibility of doing

View File

@ -192,8 +192,10 @@ bool LyXText::cursorPrevious(LCursor & cur)
int x = cur.x_target();
setCursorFromCoordinates(cur, x, 0);
bool updated = cursorUp(cur);
bool updated = setCursorFromCoordinates(cur, x, 0);
if (updated)
cur.bv().update();
updated |= cursorUp(cur);
if (cpar == cur.pit() && cpos == cur.pos()) {
// we have a row which is taller than the workarea. The
@ -213,8 +215,10 @@ bool LyXText::cursorNext(LCursor & cur)
lyx::pit_type cpar = cur.pit();
int x = cur.x_target();
setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1);
bool updated = cursorDown(cur);
bool updated = setCursorFromCoordinates(cur, x, cur.bv().workHeight() - 1);
if (updated)
cur.bv().update();
updated |= cursorDown(cur);
if (cpar == cur.pit() && cpos == cur.pos()) {
// we have a row which is taller than the workarea. The