+
+ CursorSlice const s1 = cur.selBegin();
+ CursorSlice const s2 = cur.selEnd();
+ MathData const & c1 = inset->cell(s1.idx());
+
+ if (s1.idx() == s2.idx() && &c1 == this) {
+ // selection indide cell
+ Dimension const dim = bv->coordCache().getArrays().dim(&c1);
+ int const beg = c1.pos2x(bv, s1.pos());
+ int const end = c1.pos2x(bv, s2.pos());
+ pi.pain.fillRectangle(x + beg, y - dim.ascent(),
+ end - beg, dim.height(), Color_selection);
+ } else {
+ for (idx_type i = 0; i < inset->nargs(); ++i) {
+ MathData const & c = inset->cell(i);
+ if (&c == this && inset->idxBetween(i, s1.idx(), s2.idx())) {
+ // The whole cell is selected
+ Dimension const dim = bv->coordCache().getArrays().dim(&c);
+ pi.pain.fillRectangle(x, y - dim.ascent(),
+ dim.width(), dim.height(),
+ Color_selection);
+ }
+ }