>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:
Jean-Marc> Comments? My own comment is that the patch is missing. Sigh. JMarc
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2306 diff -u -p -r1.2306 ChangeLog --- src/ChangeLog 18 Oct 2005 13:34:50 -0000 1.2306 +++ src/ChangeLog 21 Oct 2005 12:35:02 -0000 @@ -1,3 +1,13 @@ +2005-10-21 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * text3.C (dispatch): LFUN_NEXT_INSET_TOGGLE: first try to + dispatch LFUN_INSET_TOGGLE to inset at cursor, and then to + containg inset. If this does not work, the same command will be + sent to other insets down the queue by LCursor::dispatch. (bug 2066) + + * lyxfunc.C (dispatch): make sure the cursor is correct when doing + a dispatch. + 2005-10-18 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * messages.C: do not forget to include <cerrno>. Index: src/lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.670 diff -u -p -r1.670 lyxfunc.C --- src/lyxfunc.C 7 Oct 2005 14:51:39 -0000 1.670 +++ src/lyxfunc.C 21 Oct 2005 12:35:02 -0000 @@ -1438,8 +1438,11 @@ void LyXFunc::dispatch(FuncRequest const InsetIterator const end = inset_iterator_end(inset); for (; it != end; ++it) { if (inset_code == InsetBase::NO_CODE - || inset_code == it->lyxCode()) - it->dispatch(cur, fr); + || inset_code == it->lyxCode()) { + LCursor tmpcur = cur; + tmpcur.pushLeft(*it); + it->dispatch(tmpcur, fr); + } } update = true; break; Index: src/text3.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v retrieving revision 1.313 diff -u -p -r1.313 text3.C --- src/text3.C 13 Oct 2005 14:48:27 -0000 1.313 +++ src/text3.C 21 Oct 2005 12:35:02 -0000 @@ -755,12 +755,23 @@ void LyXText::dispatch(LCursor & cur, Fu 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) { - cur.clearSelection(); - FuncRequest fr = cmd; - fr.action = LFUN_INSET_TOGGLE; - inset->dispatch(cur, fr); + 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; } Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.1194 diff -u -p -r1.1194 ChangeLog --- src/insets/ChangeLog 21 Oct 2005 08:16:12 -0000 1.1194 +++ src/insets/ChangeLog 21 Oct 2005 12:35:03 -0000 @@ -1,3 +1,14 @@ +2005-10-21 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> + + * insettabular.C (doDispatch): get rid of annoying debug message. + + * insetbranch.C (doDispatch): LFUN_INSET_TOGGLE: do not replicate + code from InsetCollapsable. + + * insetcollapsable.C (doDispatch): LFUN_INSET_TOGGLE: when the + inset is toggled to Closed, move cursor to the right (part of bug + 2066). + 2005-10-20 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * insettabular.C (doDispatch): do not override the result of Index: src/insets/insetbranch.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbranch.C,v retrieving revision 1.56 diff -u -p -r1.56 insetbranch.C --- src/insets/insetbranch.C 5 Jul 2005 15:31:16 -0000 1.56 +++ src/insets/insetbranch.C 21 Oct 2005 12:35:03 -0000 @@ -143,16 +143,7 @@ void InsetBranch::doDispatch(LCursor & c case LFUN_INSET_TOGGLE: - // We assume that this lfun is indeed going to be dispatched. - cur.dispatched(); - - if (cmd.argument == "open") - setStatus(cur, Open); - else if (cmd.argument == "close") - setStatus(cur, Collapsed); - else if (cmd.argument == "toggle") - setStatus(cur, isOpen() ? Collapsed : Open); - else if (cmd.argument == "assign" || cmd.argument.empty()) { + if (cmd.argument == "assign" || cmd.argument.empty()) { // The branch inset uses "assign". BranchList const & branchlist = cur.buffer().params().branchlist(); @@ -168,6 +159,8 @@ void InsetBranch::doDispatch(LCursor & c cur.undispatched(); } } + else + InsetCollapsable::doDispatch(cur, cmd); break; default: Index: src/insets/insetcollapsable.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v retrieving revision 1.279 diff -u -p -r1.279 insetcollapsable.C --- src/insets/insetcollapsable.C 28 Sep 2005 15:02:45 -0000 1.279 +++ src/insets/insetcollapsable.C 21 Oct 2005 12:35:03 -0000 @@ -341,8 +341,13 @@ void InsetCollapsable::doDispatch(LCurso setStatus(cur, Open); else if (cmd.argument == "close") setStatus(cur, Collapsed); - else if (cmd.argument == "toggle" || cmd.argument.empty()) - setStatus(cur, isOpen() ? Collapsed : Open); + else if (cmd.argument == "toggle" || cmd.argument.empty()) + if (isOpen()) { + setStatus(cur, Collapsed); + cur.forwardPosNoDescend(); + } + else + setStatus(cur, Open); else // if assign or anything else cur.undispatched(); cur.dispatched(); Index: src/insets/insettabular.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v retrieving revision 1.490 diff -u -p -r1.490 insettabular.C --- src/insets/insettabular.C 21 Oct 2005 08:16:12 -0000 1.490 +++ src/insets/insettabular.C 21 Oct 2005 12:35:03 -0000 @@ -448,8 +448,8 @@ void InsetTabular::edit(LCursor & cur, b void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd) { - lyxerr << "# InsetTabular::doDispatch: cmd: " << cmd << endl; - lyxerr << " cur:\n" << cur << endl; + lyxerr[Debug::DEBUG] << "# InsetTabular::doDispatch: cmd: " << cmd + << "\n cur:" << cur << endl; CursorSlice sl = cur.top(); LCursor & bvcur = cur.bv().cursor();