- // FIXME We do not really want this here, but it has to be at present
- // because we need a cursor for the recordUndoFullDocument call. What
- // we would really like is a recordUndoBufferParams call that did not
- // need a cursor, but we do not have that yet.
- // 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();
- 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);
- if (!branch) {
- LYXERR0("Branch " << branch_name << " does not exist.");
- dr.setError(true);
- docstring const msg =
- bformat(_("Branch \"%1$s\" does not exist."), branch_name);
- dr.setMessage(msg);
- break;
- }
- bool activate = cmd.action() == LFUN_BRANCH_ACTIVATE;
- if (branch->isSelected() != activate) {
- branch->setSelected(activate);
- cur.recordUndoFullDocument();
- dr.setError(false);
- dr.screenUpdate(Update::Force);
- dr.forceBufferUpdate();
- }
+ case LFUN_FILE_INSERT_PLAINTEXT_PARA:
+ case LFUN_FILE_INSERT_PLAINTEXT: {
+ bool const as_paragraph = (act == LFUN_FILE_INSERT_PLAINTEXT_PARA);
+ string const fname = to_utf8(cmd.argument());
+ if (!FileName::isAbsolute(fname))
+ dr.setMessage(_("Absolute filename expected."));
+ else
+ insertPlaintextFile(FileName(fname), as_paragraph);