Change(Change::INSERTED));
}
+ // FIXME: Breaking a paragraph has nothing to do with setting a cursor.
+ // Because of the mix between the model (the paragraph contents) and the
+ // view (the paragraph breaking in rows, we have to do this here before
+ // the setCursor() call below.
+ redoParagraph(cur.bv(), cpit);
+ redoParagraph(cur.bv(), cpit + 1);
+
// This check is necessary. Otherwise the new empty paragraph will
// be deleted automatically. And it is more friendly for the user!
if (cur.pos() != 0 || isempty)
}
par.insertChar(cur.pos(), c, current_font, cur.buffer().params().trackChanges);
+
+ // FIXME: Inserting a character has nothing to do with setting a cursor.
+ // Because of the mix between the model (the paragraph contents) and the
+ // view (the paragraph breaking in rows, we have to do this here.
+ redoParagraph(cur.bv(), cur.pit());
setCursor(cur, cur.pit(), cur.pos() + 1, false, cur.boundary());
charInserted();
}
needsUpdate = dissolveInset(cur);
// Make sure the cursor is correct. Is this really needed?
- if (needsUpdate)
+ // FIXME: Inserting characters has nothing to do with setting a cursor.
+ // Because of the mix between the model (the paragraph contents)
+ // and the view (the paragraph breaking in rows, we have to do this
+ // here before the setCursorIntern() call.
+ if (needsUpdate) {
+ redoParagraph(cur.bv(), cur.pit());
setCursorIntern(cur, cur.pit(), cur.pos());
+ }
return needsUpdate;
}
if (cur.pos() == cur.lastpos())
setCurrentFont(cur);
+ // FIXME: Backspacing has nothing to do with setting a cursor.
+ // Because of the mix between the model (the paragraph contents)
+ // and the view (the paragraph breaking in rows, we have to do this
+ // here before the setCursor() call.
+ redoParagraph(cur.bv(), cur.pit());
setCursor(cur, cur.pit(), cur.pos(), false, cur.boundary());
return needsUpdate;
if (isMainText(*cur.bv().buffer()) || cur.inset().nargs() != 1)
return false;
+ bool const in_ert = cur.inset().lyxCode() == InsetBase::ERT_CODE;
recordUndoInset(cur);
cur.selHandle(false);
// save position
// FIXME: change tracking (MG)
cur.paragraph().eraseChar(cur.pos(), b.params().trackChanges);
if (!plist.empty()) {
+ if (in_ert) {
+ // ERT paragraphs have the Language latex_language.
+ // This is invalid outside of ERT, so we need to
+ // change it to the buffer language.
+ ParagraphList::iterator it = plist.begin();
+ ParagraphList::iterator it_end = plist.end();
+ for (; it != it_end; it++) {
+ it->changeLanguage(b.params(),
+ latex_language,
+ b.getLanguage());
+ }
+ }
+
pasteParagraphList(cur, plist, b.params().textclass,
b.errorList("Paste"));
// restore position