]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Add a comment.
[lyx.git] / src / BufferView.cpp
index ad4e15fb2862869a3f573debcc732982fc6542b7..53cd4d09a89ad9cf963c2d0dca41980f9b0d373d 100644 (file)
@@ -953,12 +953,10 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
                break;
        }
 
-       case LFUN_NEXT_INSET_TOGGLE: 
        case LFUN_NEXT_INSET_MODIFY: {
                // this is the real function we want to invoke
                FuncRequest tmpcmd = cmd;
-               tmpcmd.action = (cmd.action == LFUN_NEXT_INSET_TOGGLE) 
-                       ? LFUN_INSET_TOGGLE : LFUN_INSET_MODIFY;
+               tmpcmd.action = LFUN_INSET_MODIFY;
                // if there is an inset at cursor, see whether it
                // handles the lfun, other start from scratch
                Inset * inset = cur.nextInset();
@@ -1061,11 +1059,10 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
 
        case LFUN_BRANCH_ACTIVATE: 
        case LFUN_BRANCH_DEACTIVATE: {
-               bool enable = false;
+               BranchList const & branchList = buffer_.params().branchlist();
                docstring const branchName = cmd.argument();
-               if (!branchName.empty())
-                       enable = buffer_.params().branchlist().find(branchName);
-               flag.setEnabled(enable);
+               flag.setEnabled(!branchName.empty()
+                               && branchList.find(branchName));
                break;
        }
 
@@ -1411,35 +1408,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
                processUpdateFlags(Update::SinglePar | Update::FitCursor);
                break;
        }
-       case LFUN_NEXT_INSET_TOGGLE: {
-               // create the the real function we want to invoke
-               FuncRequest tmpcmd = cmd;
-               tmpcmd.action = LFUN_INSET_TOGGLE;
-               // if there is an inset at cursor, see whether it
-               // wants to toggle.
-               Inset * inset = cur.nextInset();
-               if (inset) {
-                       if (inset->isActive()) {
-                               Cursor tmpcur = cur;
-                               tmpcur.pushBackward(*inset);
-                               inset->dispatch(tmpcur, tmpcmd);
-                               if (tmpcur.result().dispatched())
-                                       cur.dispatched();
-                       } else 
-                               inset->dispatch(cur, tmpcmd);
-               }
-               // if it did not work, try the underlying inset.
-               if (!inset || !cur.result().dispatched())
-                       cur.dispatch(tmpcmd);
-
-               if (!cur.result().dispatched())
-                       // It did not work too; no action needed.
-                       break;
-               cur.clearSelection();
-               processUpdateFlags(Update::SinglePar | Update::FitCursor);
-               break;
-       }
-
        case LFUN_NEXT_INSET_MODIFY: {
                // create the the real function we want to invoke
                FuncRequest tmpcmd = cmd;
@@ -1533,6 +1501,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
 
        case LFUN_BRANCH_ACTIVATE:
        case LFUN_BRANCH_DEACTIVATE:
+               if (cmd.argument().empty())
+                       return false;
                buffer_.dispatch(cmd);
                processUpdateFlags(Update::Force);
                break;