X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=98cedccf9c93d213532b2387c72a739c08153e72;hb=1e519d1115f41f71c253cb9e2fbb7803e9a583a9;hp=70f8eaa4723fb229dda2f96ac794bba2ef393f9b;hpb=e4dba53232bc71d5a577466e7fb4a3251944d9d8;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 70f8eaa472..98cedccf9c 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -288,6 +288,35 @@ Font const Text::outerFont(pit_type par_offset) const } +int Text::getEndLabel(pit_type p) const +{ + pit_type pit = p; + depth_type par_depth = pars_[p].getDepth(); + while (pit != pit_type(pars_.size())) { + Layout const & layout = pars_[pit].layout(); + int const endlabeltype = layout.endlabeltype; + + if (endlabeltype != END_LABEL_NO_LABEL) { + if (p + 1 == pit_type(pars_.size())) + return endlabeltype; + + depth_type const next_depth = + pars_[p + 1].getDepth(); + if (par_depth > next_depth || + (par_depth == next_depth && layout != pars_[p + 1].layout())) + return endlabeltype; + break; + } + if (par_depth == 0) + break; + pit = outerHook(pit); + if (pit != pit_type(pars_.size())) + par_depth = pars_[pit].getDepth(); + } + return END_LABEL_NO_LABEL; +} + + static void acceptOrRejectChanges(ParagraphList & pars, BufferParams const & bparams, Text::ChangeOp op) { @@ -2047,7 +2076,7 @@ docstring Text::getPossibleLabel(DocIterator const & cur) const // We need a unique label docstring label = text; int i = 1; - while (cur.buffer()->insetLabel(label)) { + while (cur.buffer()->activeLabel(label)) { label = text + '-' + convert(i); ++i; }