From 2da183bf4f69847e30c9c9ab8a32548432a8a8b1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 24 Jan 2022 19:19:46 +0100 Subject: [PATCH] Check layout type when inserting inset over selection When inserting inset over a selection, the layout is transferred if the inset covers full paragraphs. This is not the right policy in the case of environments. Until proper code is written and tested, limit ourselves to command layouts. Fixes bug #12251. --- src/Text3.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index a87169b934..529e756a97 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -299,8 +299,11 @@ static bool doInsertInset(Cursor & cur, Text * text, * 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. + * FIXME: figure out a good test in the environment case (see #12251). */ - if (cur.paragraph().empty() && !inset->forcePlainLayout()) { + if (cur.paragraph().layout().isCommand() + && cur.paragraph().empty() + && !inset->forcePlainLayout()) { cur.paragraph().setPlainOrDefaultLayout(bparams.documentClass()); move_layout = true; }