+2005-11-07 Martin Vermeer <martin.vermeer@hut.fi>
+
+ * cursor.C (selectionBegin, selectionEnd):
+ * text.C (drawSelection): Fix bug 2115: assertion when anchor and
+ cursor at different depths
+
2005-11-03 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* bufferview_funcs.C (coordOffset): do not call cursorPos
{
if (!selection())
return *this;
- return anchor() < top() ? anchor_ : *this;
+ DocIterator di = (anchor() < top() ? anchor_ : *this);
+ di.resize(depth());
+ return di;
}
{
if (!selection())
return *this;
- return anchor() > top() ? anchor_ : *this;
+ DocIterator di = (anchor() > top() ? anchor_ : *this);
+ if (di.depth() > depth()) {
+ di.resize(depth());
+ ++di.pos();
+ }
+ return di;
}
lyxerr << "draw selection at " << x << endl;
- // is there a better way of getting these two iterators?
- DocIterator beg = cur;
- DocIterator end = cur;
-
- beg.top() = cur.selBegin();
- end.top() = cur.selEnd();
+ DocIterator beg = cur.selectionBegin();
+ DocIterator end = cur.selectionEnd();
// the selection doesn't touch the visible screen
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW
<< "draw selection at " << x
<< endl;
- // is there a better way of getting these two iterators?
- DocIterator beg = cur;
- DocIterator end = cur;
-
- beg.top() = cur.selBegin();
- end.top() = cur.selEnd();
+ DocIterator beg = cur.selectionBegin();
+ DocIterator end = cur.selectionEnd();
// the selection doesn't touch the visible screen
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW