X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=6c899a95e8f7f65d86210de687f785cd7dfa85ce;hb=b65d0c087bc8cc61ec898210852c7ea39ab64ee4;hp=25f58d55dd89a1915e6a6592b12da989f90f8d7e;hpb=430d03811e15c5f78e3c7110a95683a4e24d37fc;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 25f58d55dd..6c899a95e8 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -1897,8 +1897,6 @@ docstring Text::getPossibleLabel(Cursor const & cur) const } if (!name.empty()) - // FIXME refstyle - // We should allow customization of the separator or else change it text = name + ':' + text; return text; @@ -1923,6 +1921,15 @@ docstring Text::asString(pit_type beg, pit_type end, int options) const } +void Text::forToc(docstring & os, size_t maxlen, bool shorten) const +{ + LASSERT(maxlen > 10, maxlen = 30); + for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i) + pars_[i].forToc(os, maxlen); + if (shorten && os.length() >= maxlen) + os = os.substr(0, maxlen - 3) + from_ascii("..."); +} + void Text::charsTranspose(Cursor & cur) {