I think there is a general problem in the trunk with the getStatus() dispatch mechanism. If I put a breakpoint here, at line ~915 of BufferView.cpp:
   case LFUN_LAYOUT:
       flag.enabled(!cur.inset().forceEmptyLayout(cur.idx()));
       break;
it never gets hit. The reason seems to be this. In LyXFunc.cpp, we get here:
   default:
       if (!view()) {
           enable = false;
           break;
       }
       if (!getLocalStatus(view()->cursor(), cmd, flag))
           flag = view()->getStatus(cmd);
   }
so we'll go to BufferView::getStatus only if getLocalStatus returns false, which is supposed to mean that the command hasn't been handled yet. So, in getLocalStatus we have:
   for ( ; cursor.depth(); cursor.pop()) {
       // The inset's getStatus() will return 'true' if it made
       // a definitive decision on whether it want to handle the
       // request or not. The result of this decision is put into
       // the 'status' parameter.
       if (cursor.inset().getStatus(cursor, cmd, status)) {
           res = true;
           break;
       }
   }
   return res;
so, for example, we call InsetTabular::getStatus, which sends us off to InsetText::getStatus, which just goes to Text::getStatus. There, we do this:
   case LFUN_LAYOUT:
   ....
       // these are handled in our dispatch()... OH YEAH???
       enable = true;
       break;

   default:
       return false;
   }

   flag.enabled(enable);
   return true;
So we end up returning true, for sure, and the flag has been enabled without any check. And, of course, we only go once around the loop in getLocalStatus.

I don't understand this dispatch business well enough to fix this. But it does seem as if something here is wrong. Certainly, there's no dispatching going on at this point, as my silly comment indicates.

rh

Reply via email to