if (layoutname.empty())
layoutname = tclass.defaultLayoutName();
- if (par.forceEmptyLayout()) {
+ if (par.forcePlainLayout()) {
// in this case only the empty layout is allowed
layoutname = tclass.emptyLayoutName();
- } else if (par.useEmptyLayout()) {
+ } else if (par.usePlainLayout()) {
// in this case, default layout maps to empty layout
if (layoutname == tclass.defaultLayoutName())
layoutname = tclass.emptyLayoutName();
layoutname = tclass.defaultLayoutName();
}
- bool hasLayout = tclass.hasLayout(layoutname);
-
- if (!hasLayout) {
- errorList.push_back(ErrorItem(_("Unknown layout"),
- bformat(_("Layout '%1$s' does not exist in textclass '%2$s'\nTrying to use the default instead.\n"),
- layoutname, from_utf8(tclass.name())), par.id(), 0, par.size()));
- layoutname = par.useEmptyLayout() ?
- tclass.emptyLayoutName() :
- tclass.defaultLayoutName();
- }
+ // When we apply an unknown layout to a document, we add this layout to the textclass
+ // of this document. For example, when you apply class article to a beamer document,
+ // all unknown layouts such as frame will be added to document class article so that
+ // these layouts can keep their original names.
+ tclass.addLayoutIfNeeded(layoutname);
par.setLayout(bp.documentClass()[layoutname]);
Paragraph const & par = cur.paragraph();
// Paragraph boundary is a word boundary
- if (pos == lastpos)
+ if (pos == lastpos) {
if (pit != cur.lastpit())
return setCursor(cur, pit + 1, 0);
else
return false;
+ }
if (lyxrc.mac_like_word_movement) {
// Skip through trailing punctuation and spaces.
- while (pos != lastpos && par.isChar(pos))
+ while (pos != lastpos && (par.isChar(pos) || par.isSpace(pos)))
++pos;
// Skip over either a non-char inset or a full word
return setCursor(cur, pit - 1, getPar(pit - 1).size());
if (lyxrc.mac_like_word_movement) {
- // Skip through puctuation and spaces.
- while (pos != 0 && par.isChar(pos - 1))
+ // Skip through punctuation and spaces.
+ while (pos != 0 && (par.isChar(pos - 1) || par.isSpace(pos - 1)))
--pos;
// Skip over either a non-char inset or a full word
}
// otherwise reset to default
- cur.paragraph().setEmptyOrDefaultLayout(bufparams.documentClass());
+ cur.paragraph().setPlainOrDefaultLayout(bufparams.documentClass());
return true;
}
// or the empty layout.
else if (par.layout() == prevpar.layout()
|| tclass.isDefaultLayout(par.layout())
- || tclass.isEmptyLayout(par.layout())) {
+ || tclass.isPlainLayout(par.layout())) {
cur.recordUndo(ATOMIC_UNDO, prevcur.pit());
mergeParagraph(bufparams, plist, prevcur.pit());
needsUpdate = true;