From df0801cf65356c537ebd9fe7e1c8d070a55c6bfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Thu, 23 Jul 2009 06:14:11 +0000 Subject: [PATCH] * Text2.cpp (setParagraphs): - issue setLabelWidthStringToSequence only once for a selected range of paragraphs of the same layout and depth. This fixes an assertion reported here: http://marc.info/?l=lyx-devel&m=124774758211589 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30752 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text2.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/Text2.cpp b/src/Text2.cpp index af49b982df..ed2f3fd0ba 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -443,16 +443,23 @@ void Text::setParagraphs(Cursor & cur, docstring arg, bool merge) //FIXME UNICODE string const argument = to_utf8(arg); + depth_type priordepth = -1; + Layout priorlayout; for (pit_type pit = cur.selBegin().pit(), end = cur.selEnd().pit(); pit <= end; ++pit) { Paragraph & par = pars_[pit]; ParagraphParameters params = par.params(); params.read(argument, merge); - // changes to label width string apply to all - // paragraph with same layout in a sequence - setLabelWidthStringToSequence(pit, pars_, - params.labelWidthString()); + // Changes to label width string apply to all paragraphs + // with same layout in a sequence. + // Do this only once for a selected range of paragraphs + // of the same layout and depth. + if (par.getDepth() != priordepth || par.layout() != priorlayout) + setLabelWidthStringToSequence(pit, pars_, + params.labelWidthString()); par.params().apply(params, par.layout()); + priordepth = par.getDepth(); + priorlayout = par.layout(); } } @@ -467,15 +474,22 @@ void Text::setParagraphs(Cursor & cur, ParagraphParameters const & p) pit_type undopit = undoSpan(cur.selEnd().pit()); recUndo(cur, cur.selBegin().pit(), undopit - 1); + depth_type priordepth = -1; + Layout priorlayout; for (pit_type pit = cur.selBegin().pit(), end = cur.selEnd().pit(); pit <= end; ++pit) { Paragraph & par = pars_[pit]; - // changes to label width string apply to all - // paragraph with same layout in a sequence - setLabelWidthStringToSequence(pit, pars_, - par.params().labelWidthString()); + // Changes to label width string apply to all paragraphs + // with same layout in a sequence. + // Do this only once for a selected range of paragraphs + // of the same layout and depth. + if (par.getDepth() != priordepth || par.layout() != priorlayout) + setLabelWidthStringToSequence(pit, pars_, + par.params().labelWidthString()); par.params().apply(p, par.layout()); - } + priordepth = par.getDepth(); + priorlayout = par.layout(); + } } -- 2.39.2