- if (size() == 1) {
- x = bv().text()->cursorX(front());
- y = bv().text()->cursorY(front());
- } else {
- inset().getCursorPos(back(), x, y);
- // getCursorPos gives _screen_ coordinates. We need to add
- // top_y to get document coordinates. This is hidden in cached_y_.
- //y += cached_y_ - inset().yo();
- // The rest is non-obvious. The reason we have to have these
- // extra computation is that the getCursorPos() calls rely
- // on the inset's own knowledge of its screen position.
- // If we scroll up or down in a big enough increment,
- // inset->draw() is not called: this doesn't update
- // inset.yo_, so getCursor() returns an old value.
- // Ugly as you like.
- }
- //lyxerr << "#### LCursor::getPos: " << *this
- // << " x: " << x << " y: " << y << endl;