- BufferParams const & bp = cur.buffer().params();
- LayoutPtr const layout =
- bp.getTextClass().defaultLayout();
- //lyxerr << "\nInsetERT::doDispatch (begin): cmd: " << cmd << endl;
- switch (cmd.action) {
-
- case LFUN_MOUSE_PRESS:
- if (cmd.button() != mouse_button::button3)
- InsetCollapsable::doDispatch(cur, cmd);
- else
- // This makes the cursor leave the
- // inset when it collapses on mouse-3
- cur.undispatched();
- break;
-
- case LFUN_QUOTE_INSERT: {
- // We need to bypass the fancy quotes in Text
- FuncRequest f(LFUN_SELF_INSERT, "\"");
- dispatch(cur, f);
- break;
- }
- case LFUN_INSET_MODIFY: {
- InsetCollapsable::CollapseStatus st;
- InsetERTMailer::string2params(to_utf8(cmd.argument()), st);
- setStatus(cur, st);
- break;
- }
- case LFUN_PASTE:
- case LFUN_CLIPBOARD_PASTE:
- case LFUN_PRIMARY_SELECTION_PASTE: {
- InsetCollapsable::doDispatch(cur, cmd);
-
- // Since we can only store plain text, we must reset all
- // attributes.
- // FIXME: Change only the pasted paragraphs
-
- Font font = layout->font;
- // ERT contents has always latex_language
- font.setLanguage(latex_language);
- ParagraphList::iterator const end = paragraphs().end();
- for (ParagraphList::iterator par = paragraphs().begin();
- par != end; ++par) {
- // in case par had a manual label
- par->setBeginOfBody();
- pos_type const siz = par->size();
- for (pos_type i = 0; i < siz; ++i) {
- par->setFont(i, font);
- }
- par->params().clear();
+ switch (cmd.action()) {
+ case LFUN_INSET_MODIFY:
+ if (cmd.getArg(0) == "ert") {
+ cur.recordUndoInset(this);
+ setStatus(cur, string2params(to_utf8(cmd.argument())));
+ break;