diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 5f54c6c350..52ac54533b 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -1054,6 +1054,7 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd) case LFUN_BIBDB_ADD: case LFUN_BIBDB_DEL: case LFUN_WORDS_COUNT: + case LFUN_NEXT_INSET_TOGGLE: flag.enabled(true); break; @@ -1351,6 +1352,30 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd) buffer_->params().compressed = !buffer_->params().compressed; break; + case LFUN_NEXT_INSET_TOGGLE: { + // this is the real function we want to invoke + FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.origin); + // if there is an inset at cursor, see whether it + // wants to toggle. + InsetBase * inset = cur.nextInset(); + if (inset && inset->isActive()) { + LCursor tmpcur = cur; + tmpcur.pushLeft(*inset); + inset->dispatch(tmpcur, tmpcmd); + if (tmpcur.result().dispatched()) { + cur.dispatched(); + } + } + // if it did not work, try the underlying inset. + if (!cur.result().dispatched()) + cur.dispatch(tmpcmd); + + if (cur.result().dispatched()) + cur.clearSelection(); + + break; + } + default: return false; } diff --git a/src/ChangeLog b/src/ChangeLog index 4d4a2a38f7..e45b8de5d8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2006-08-09 Jean-Marc Lasgouttes + + * BufferView_pimpl.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved from + LyXText. + + * text3.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved to + BufferView::Pimpl, since this should work in mathed too. + 2006-08-10 Jean-Marc Lasgouttes * buffer.C (save): fix logic error in fix to bug 2740. diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index c5cefdfa68..6ca3128167 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,8 @@ +2006-08-09 Jean-Marc Lasgouttes + + * math_nestinset.C (doDispatch/LFUN_INSET_TOGGLE): do not try to + do the work which belongs to LFUN_NEXT_INSET_TOGGLE (bug 2756). + 2006-08-09 Jean-Marc Lasgouttes * math_nestinset.C (script): diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 6f1e8384a4..7c91334dbd 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -649,15 +649,8 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd) case LFUN_INSET_TOGGLE: recordUndo(cur); - //lockToggle(); - if (cur.pos() != cur.lastpos()) { - // toggle previous inset ... - cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock()); - } else if (cur.popLeft() && cur.pos() != cur.lastpos()) { - // ... or enclosing inset if we are in the last inset position - cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock()); - ++cur.pos(); - } + lock(!lock()); + cur.popRight(); break; case LFUN_SELFINSERT: diff --git a/src/text3.C b/src/text3.C index a9d48c9e77..7aa71d7cb2 100644 --- a/src/text3.C +++ b/src/text3.C @@ -674,28 +674,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) cur.inset().showInsetDialog(bv); break; - case LFUN_NEXT_INSET_TOGGLE: { - InsetBase * inset = cur.nextInset(); - // this is the real function we want to invoke - cmd = FuncRequest(LFUN_INSET_TOGGLE); - cur.undispatched(); - // if there is an inset at cursor, see whether it - // wants to toggle. - if (inset) { - LCursor tmpcur = cur; - tmpcur.pushLeft(*inset); - inset->dispatch(tmpcur, cmd); - if (tmpcur.result().dispatched()) { - cur.clearSelection(); - cur.dispatched(); - } - } - // if it did not work, try the underlying inset. - if (!cur.result().dispatched()) - cur.inset().dispatch(cur, cmd); - break; - } - case LFUN_SPACE_INSERT: if (cur.paragraph().layout()->free_spacing) insertChar(cur, ' '); @@ -1719,7 +1697,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, case LFUN_BREAKPARAGRAPH_SKIP: case LFUN_PARAGRAPH_SPACING: case LFUN_INSET_INSERT: - case LFUN_NEXT_INSET_TOGGLE: case LFUN_UPCASE_WORD: case LFUN_LOWCASE_WORD: case LFUN_CAPITALIZE_WORD: diff --git a/status.14x b/status.14x index 7cb424488a..2b721b73aa 100644 --- a/status.14x +++ b/status.14x @@ -24,12 +24,16 @@ What's new - New Czech translation; update Italian localization. -- Updated Czech translation of the Tutorial. +- Updated Czech translation of the Tutorial; new Czech translation of + the splash document. ** Bug fixes: * Document Input/Output +- Fix crash when using next-inset-toggle (Ctrl+I) inside mathed; make + inset locking in mathed generally work (bug 2756). + - Fix crash on save (including dataloss) when the backup directory was invalid or not writeable(bug 2740).