return 0;
}
+
/// Note that comparing contents can only be used for InsetCommand
bool findNextInset(DocIterator & dit, vector<InsetCode> const & codes,
docstring const & contents)
// handle their dispatch here, for reasons explained there, so we'll
// handle this here, too, for consistency.
case LFUN_BRANCH_ACTIVATE:
- case LFUN_BRANCH_DEACTIVATE: {
- BranchList const & branchList = buffer().params().branchlist();
+ case LFUN_BRANCH_DEACTIVATE:
+ case LFUN_BRANCH_MASTER_ACTIVATE:
+ case LFUN_BRANCH_MASTER_DEACTIVATE: {
+ bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
+ BranchList const & branchList = master ? buffer().masterBuffer()->params().branchlist()
+ : buffer().params().branchlist();
docstring const branchName = cmd.argument();
flag.setEnabled(!branchName.empty() && branchList.find(branchName));
break;
void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
{
- //lyxerr << [ cmd = " << cmd << "]" << endl;
-
- // Make sure that the cached BufferView is correct.
- LYXERR(Debug::ACTION, " action[" << cmd.action() << ']'
- << " arg[" << to_utf8(cmd.argument()) << ']'
- << " x[" << cmd.x() << ']'
- << " y[" << cmd.y() << ']'
- << " button[" << cmd.button() << ']');
+ LYXERR(Debug::ACTION, "BufferView::dispatch: cmd: " << cmd);
string const argument = to_utf8(cmd.argument());
Cursor & cur = d->cursor_;
switch (act) {
case LFUN_BUFFER_PARAMS_APPLY: {
- DocumentClassConstPtr oldClass = buffer_.params().documentClassPtr();
+ DocumentClassConstPtr olddc = buffer_.params().documentClassPtr();
cur.recordUndoFullDocument();
istringstream ss(to_utf8(cmd.argument()));
Lexer lex;
<< unknown_tokens << " unknown token"
<< (unknown_tokens == 1 ? "" : "s"));
}
- updateDocumentClass(oldClass);
+ updateDocumentClass(olddc);
// We are most certainly here because of a change in the document
// It is then better to make sure that all dialogs are in sync with
// So, if this does get fixed, this code can be moved back to Buffer.cpp,
// and the corresponding code in getStatus() should be moved back, too.
case LFUN_BRANCH_ACTIVATE:
- case LFUN_BRANCH_DEACTIVATE: {
- BranchList & branch_list = buffer().params().branchlist();
+ case LFUN_BRANCH_DEACTIVATE:
+ case LFUN_BRANCH_MASTER_ACTIVATE:
+ case LFUN_BRANCH_MASTER_DEACTIVATE: {
+ bool const master = (cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_DEACTIVATE);
+ Buffer * buf = master ? const_cast<Buffer *>(buffer().masterBuffer())
+ : &buffer();
+
docstring const branch_name = cmd.argument();
// the case without a branch name is handled elsewhere
if (branch_name.empty()) {
dispatched = false;
break;
}
- Branch * branch = branch_list.find(branch_name);
+ Branch * branch = buf->params().branchlist().find(branch_name);
if (!branch) {
LYXERR0("Branch " << branch_name << " does not exist.");
dr.setError(true);
dr.setMessage(msg);
break;
}
- bool activate = cmd.action() == LFUN_BRANCH_ACTIVATE;
+ bool activate = (cmd.action() == LFUN_BRANCH_ACTIVATE
+ || cmd.action() == LFUN_BRANCH_MASTER_ACTIVATE);
if (branch->isSelected() != activate) {
branch->setSelected(activate);
cur.recordUndoFullDocument();
cap::saveSelection(cursor());
d->cursor_.macroModeClose();
+ // If a macro has been finalized, the cursor might have been broken
+ cur.fixIfBroken();
// Has the cursor just left the inset?
bool const leftinset = (&d->cursor_.inset() != &cur.inset());