> normalize() is called only from the LFUN_CUT case of 
> InsetMathNest::doDispatch().
> It corrects only the pos of the top cursor slice (if needed), AFAICS.
>
>> Fact is, we should apparently not call normalize() from a non-math
>> inset, so there is something wrong there if it happens.
>
> Is an ASSERT better than a crash than?

Yes, of course.

However, normalize() is only called from one place. There it is called
after a call to cutSelection(). Cursor::cutSelection either :

- does nothing if there is no selection,
- calls "cur.pos() = endpos" if the cursor is in Text, or
- calls "cur.pos() = cur.lastpos()" or "cur.pos() = 0" if the cursor is in Math.

So, cur.pos() seems to be never > cur.lastpos().

If we are in math, we do not delete cells, so cur.idx() cannot be >
cur.lastidx().

So.. we can just remove Cursor::normalize() altogether.

Vincent

Reply via email to