commit 13d24c711e745ea0c6ea2019236025d14bd2defa Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Sun Mar 26 20:28:00 2023 +0200
When breaking a paragraph, do not reset depth Remove some logic that would reset depth when editing non-environment stuff (e.g. Standard layout) at non-zero depth. The current way of decreasing depth is to use paragraph-break in an empty paragraph. See discussion in ticket #2445 for why this code happened. Fixes bug #12750. --- src/Text.cpp | 19 +++++-------------- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Text.cpp b/src/Text.cpp index a61e325..dfef748 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -716,9 +716,8 @@ double Text::spacing(Paragraph const & par) const /** * This breaks a paragraph at the specified position. * The new paragraph will: - * - Decrease depth by one (or change layout to default layout) when - * keep_layout == false - * - keep current depth and layout when keep_layout == true + * - change layout to default layout when keep_layout == false + * - keep layout when keep_layout == true */ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos, bool keep_layout) @@ -733,21 +732,13 @@ static void breakParagraph(Text & text, pit_type par_offset, pos_type pos, // remember to set the inset_owner tmp->setInsetOwner(&par.inInset()); - // without doing that we get a crash when typing <Return> at the - // end of a paragraph - tmp->setPlainOrDefaultLayout(bparams.documentClass()); + tmp->params().depth(par.params().depth()); if (keep_layout) { tmp->setLayout(par.layout()); tmp->setLabelWidthString(par.params().labelWidthString()); - tmp->params().depth(par.params().depth()); - } else if (par.params().depth() > 0) { - Paragraph const & hook = pars[text.outerHook(par_offset)]; - tmp->setLayout(hook.layout()); - // not sure the line below is useful - tmp->setLabelWidthString(par.params().labelWidthString()); - tmp->params().depth(hook.params().depth()); - } + } else + tmp->setPlainOrDefaultLayout(bparams.documentClass()); bool const isempty = (par.allowEmpty() && par.empty()); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs