The following patch fixes the context menus for conglomerate-like insets. The problem was in the way next-inset-toggle and inset-toggle work.
Here is the situation as it used to be. I am not sure what the current one exactly is. * next-inset-toggle finds a suitable inset, either next to cursor or enclosing, and calls inset-toggle on it. * inset-toggle is a peculiar function, in that it expect that the top-level cursor position is on the inset itself. This makes sense for collapsable insets, which can be the base of a cursor slice. For insetref, the situation is of course a bit more complicated... Initially, inset-toggle was an internal function and did not have a name. I am not sure why it was not a virtual method, actually. Normally, I believe that all calls to next-inset-xxx should be inset-xxx instead in stdcontext.inc. However, the inset-modify functions cannot work this way, since they do not push a slice when needed. Is this a design decision? What is the plan? JMarc
svndiff Index: src/insets/InsetCollapsable.cpp =================================================================== --- src/insets/InsetCollapsable.cpp (revision 24189) +++ src/insets/InsetCollapsable.cpp (working copy) @@ -707,11 +707,14 @@ bool InsetCollapsable::getStatus(Cursor return InsetText::getStatus(cur, cmd, flag); case LFUN_INSET_TOGGLE: - if ((cmd.argument() == "open" && status_ != Open) - || (cmd.argument() == "close" && status_ == Open) - || cmd.argument() == "toggle" || cmd.argument().empty()) - flag.enabled(true); - else + if (cmd.argument() == "open") + flag.enabled(status_ != Open); + else if (cmd.argument() == "close") + flag.enabled(status_ == Open); + else if (cmd.argument() == "toggle" || cmd.argument().empty()) { + flag.enabled(true); + flag.setOnOff(status_ == Open); + } else flag.enabled(false); return true; Index: lib/ui/stdcontext.inc =================================================================== --- lib/ui/stdcontext.inc (revision 24189) +++ lib/ui/stdcontext.inc (working copy) @@ -101,15 +101,15 @@ Menuset # InsetCollapsable context menu # Menu "context-collapsable" - OptItem "Open Inset|O" "next-inset-toggle open" - OptItem "Close Inset|C" "next-inset-toggle close" + OptItem "Open Inset|O" "inset-toggle open" + OptItem "Close Inset|C" "inset-toggle close" Separator Item "Dissolve Inset|D" "inset-dissolve" OptItem "Settings...|S" "inset-settings" End Menu "context-conglomerate" - Item "Toggle Label|L" "next-inset-toggle" + Item "Show Name|N" "inset-toggle" Item "Dissolve Inset|D" "inset-dissolve charstyle" Separator OptItem "Settings...|S" "inset-settings"