On Tuesday 02 September 2003 5:56 pm, Martin Vermeer wrote: > > The toggle code in all it's glory is (text3.C): > > case LFUN_INSET_TOGGLE: > > bv->beforeChange(this); > > toggleInset(); > > bv->update(); > > bv->switchKeyMap(); > > break; > > > > Angus > > ...but am I right in seeing that this code doesn't actually move the > cursor? I.e., contrary to your description above?
No, it moves the cursor. See below. Perhaps you might split this into two and create LFUN_INSET_GOTO_NEXT or some such? If you get adventurous, you might allow it to take an optional argument so that you can choose what sort of inset to goto: lfun_inset_goto_next "citation" There are a whole heap of LFUN.*GOTO lfuns that could be collapsed into one... Maybe that's for another day ;-) Angus void LyXText::toggleInset() { InsetOld * inset = getInset(); // is there an editable inset at cursor position? if (!isEditableInset(inset)) { // No, try to see if we are inside a collapsable inset if (inset_owner && inset_owner->owner() && inset_owner->owner()->isOpen()) { bv()->unlockInset(inset_owner->owner()); inset_owner->owner()->close(bv()); bv()->getLyXText()->cursorRight(bv()); } return; } //bv()->owner()->message(inset->editMessage()); // do we want to keep this?? (JMarc) if (!isHighlyEditableInset(inset)) recordUndo(bv(), Undo::ATOMIC); if (inset->isOpen()) inset->close(bv()); else inset->open(bv()); bv()->updateInset(inset); }