>hmmm, looking at the preceding line: > > cur.insert(new InsetMathHull(cur.buffer(), hullRegexp)); > if (cur.nextInset()) { > cur.nextInset()->edit(cur, true); > cur.niceInsert(sel); > } > >What happens now is that the cur.insert() call is made anyway, but, if >there was a selection when pressing C-S-r, then it is not reinserted in the >regexp inset anymore (this is the crashing code that has been excluded). > >However, unless the cur.insert() method stops at some point due to the >unallowed nesting of inset, I would assume it has been inserted, am I >wrong ? >
Cur.insert() stops at some point, namely in Paragraph::insertInset(..) if (!d->inset_owner_->insetAllowed(inset->lyxCode())) return false; So, nothing is done if the ERT does not allow an Inset with code MATH_CODE. The relevant line for this is in InsetText.h: >Perhaps, I should tweak the InsetERT::plaintext() method to search also >or possibly nested insets. I've no idea what you mean with this. >Or, if I stop there with gdb, what variables can I check to verify whether >there is a nested inset somewhere or not ? cur.nextInset returns 0, so then you know there is no nested Inset. That's correct because the code in paragraph::insertInset forbids inserting a regexp in an ERT. Thanks, T.