#include "paragraph_funcs.h"
#include "pariterator.h"
-#include "insets/updatableinset.h"
#include "insets/insettabular.h"
#include "insets/insettext.h"
for (int i = 0; ; ++i) {
int xo;
int yo;
- LCursor cur = c;
- cur.setCursor(it);
- cur.inset().getCursorPos(cur.top(), xo, yo);
+ it.inset().cursorPos(it.top(), c.boundary() && ((i+1) == it.depth()), xo, yo);
double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
// '<=' in order to take the last possible position
// this is important for clicking behind \sum in e.g. '\sum_i a'
// avoid invalid nesting when selecting
if (bv_funcs::status(&cursor.bv(), it) == bv_funcs::CUR_INSIDE
&& (!cursor.selection() || positionable(it, cursor.anchor_))) {
- Point p = bv_funcs::getPos(it);
+ Point p = bv_funcs::getPos(it, false);
int xo = p.x_;
int yo = p.y_;
if (xlow <= xo && xo <= xhigh && ylow <= yo && yo <= yhigh) {
// bv functions are not yet available!
LCursor::LCursor(BufferView & bv)
: DocIterator(), bv_(&bv), anchor_(), x_target_(-1),
- selection_(false), mark_(false)
+ selection_(false), mark_(false), logicalpos_(false)
{}
void LCursor::getPos(int & x, int & y) const
{
- Point p = bv_funcs::getPos(*this);
+ Point p = bv_funcs::getPos(*this, boundary());
x = p.x_;
y = p.y_;
}
void LCursor::setSelection()
{
selection() = true;
- // a selection with no contents is not a selection
+ // A selection with no contents is not a selection
#ifdef WITH_WARNINGS
#warning doesnt look ok
#endif
selection() = true;
anchor_ = where;
pos() += n;
+ // Open all collapsed insets
+ for (int i = depth() - 1; i >= 0; --i)
+ operator[](i).inset().setStatus(*this, InsetBase::Open);
}