Disable LFUN_LAYOUT when layout cannot be found

Fixes bug #8077
This commit is contained in:
Jean-Marc Lasgouttes 2015-11-10 18:42:24 +01:00
parent d264b3d8fb
commit 0f5886b856

View File

@ -3108,13 +3108,12 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
case LFUN_LAYOUT: {
enable = !cur.inset().forcePlainLayout();
DocumentClass const & tclass = cur.buffer()->params().documentClass();
docstring layout = cmd.argument();
if (layout.empty()) {
DocumentClass const & tclass = cur.buffer()->params().documentClass();
if (layout.empty())
layout = tclass.defaultLayoutName();
}
enable = !cur.inset().forcePlainLayout() && tclass.hasLayout(layout);
flag.setOnOff(layout == cur.paragraph().layout().name());
break;
}