for (; it != it_end; ++it)
it->changeLanguage(b.params(), latex_language, b.language());
+ /* the inset is the only thing in paragraph, then the layout
+ * of the first paragraph of inset should be remembered.
+ * FIXME: this does not work as expected when change tracking
+ * is on However, we do not really know what to do in this
+ * case.
+ */
+ if (inset_it.lastpos() == 1
+ && inset_it.nextInset() && !inset_it.nextInset()->forcePlainLayout())
+ cur.paragraph().makeSameLayout(plist[0]);
+
pasteParagraphList(cur, plist, b.params().documentClassPtr(),
b.errorList("Paste"));
}
if (cur.selection()) {
if (cmd.action() == LFUN_INDEX_INSERT)
copySelectionToTemp(cur);
- else
+ else {
cutSelectionToTemp(cur, pastesel);
+ /* Move layout information inside the inset if the whole
+ * paragraph and the inset allows setting layout
+ * FIXME: this does not work as expected when change tracking is on
+ * However, we do not really know what to do in this case.
+ */
+ if (cur.paragraph().empty() && !inset->forcePlainLayout())
+ cur.paragraph().setPlainOrDefaultLayout(bparams.documentClass());
+ }
cur.clearSelection();
gotsel = true;
} else if (cmd.action() == LFUN_INDEX_INSERT) {
InsetText * inset_text = inset->asInsetText();
if (inset_text) {
inset_text->fixParagraphsFont();
- if (!inset_text->allowMultiPar() || cur.lastpit() == 0) {
- // reset first par to default
- cur.text()->paragraphs().begin()
- ->setPlainOrDefaultLayout(bparams.documentClass());
- cur.pos() = 0;
- cur.pit() = 0;
- // Merge multiple paragraphs -- hack
- while (cur.lastpit() > 0)
- mergeParagraph(bparams, cur.text()->paragraphs(), 0);
- if (cmd.action() == LFUN_FLEX_INSERT)
- return true;
- Cursor old = cur;
- cur.leaveInset(*inset);
- if (cmd.action() == LFUN_PREVIEW_INSERT
- || cmd.action() == LFUN_IPA_INSERT)
- // trigger preview
- notifyCursorLeavesOrEnters(old, cur);
- }
+ cur.pos() = 0;
+ cur.pit() = 0;
+ // FIXME: what does this do?
+ if (cmd.action() == LFUN_FLEX_INSERT)
+ return true;
+ Cursor old = cur;
+ cur.leaveInset(*inset);
+ if (cmd.action() == LFUN_PREVIEW_INSERT
+ || cmd.action() == LFUN_IPA_INSERT)
+ // trigger preview
+ notifyCursorLeavesOrEnters(old, cur);
} else {
cur.leaveInset(*inset);
// reset surrounding par to default