+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.
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.
// 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();
<< " pos: " << pos
<< endl;
- setCursor(cur, pit, pos, true, bound);
+ return setCursor(cur, pit, pos, true, bound);
}
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
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
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
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