Le 07/02/2018 à 20:12, Pavel Sanda a écrit :
Something like what inset-forall does?
The idea is to use an InsetIterator (just a DocIterator that does
forwardInset() with operator++ and returns the inset with operator*. Then one
has to check the inset code by hand (which is not nice IMO).
But I need range from [cur.selectionBegin();cur.selectionEnd()] so neither
of proposed ideas works in straightforward way.
inset-forall should be improved to limit itself to current selection if
needed.
This is what I come up with, if (!from.nextInset()) line is taken from
inset-forall but I have actually no idea what situation it handles.
Comments?
This looks reasonable. The test you mention is to make sire that at any
time the cursor is in front of an inset. At the beginning, the selection
probably starts on some text, so if it better to jump to the next inset.
The usual way to test for insets in the code is to compare the lyxCode()
value, rather than a layout name string. At least the compiler will
check that you are testing against a value that makes sense.
JMarc