while (1) {
// avoid invalid nesting when selecting
if (!selection_ || positionable(it.cursor(), Anchor_)) {
- int xo = it.position().xpos();
- int yo = it.position().ypos();
+ MathCursorPos const & top = it.position();
+ int xo = top.xpos();
+ int yo = top.ypos();
if (xlow - 2 <= xo && xo <= xhigh + 2 &&
ylow - 2 <= yo && yo <= yhigh + 2)
{
//if (drawn_ && x == xo_ && y == yo_)
// return;
+ //lyxerr << "x: " << x << " y: " << y << " " << pain.workAreaHeight() << endl;
+
xo_ = x;
yo_ = y;
drawn_ = true;
+ if (y + descent_ <= 0) // don't draw above the workarea
+ return;
+ if (y - ascent_ >= pain.paperHeight()) // don't draw below the workarea
+ return;
+ if (x + width_ <= 0) // don't draw left of workarea
+ return;
+ if (x >= pain.paperWidth()) // don't draw right of workarea
+ return;
+
const_iterator it = begin(), et = end();
if (it == et) {