X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText.cpp;h=6c899a95e8f7f65d86210de687f785cd7dfa85ce;hb=e2982037d9f981a6070c3cf90148bde33edbfdc9;hp=63cf1734b9b88551bc5d1301e63b41c75e7d375e;hpb=c68d754a749f2b5d162868544c07c21d6168b84b;p=lyx.git diff --git a/src/Text.cpp b/src/Text.cpp index 63cf1734b9..6c899a95e8 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -850,7 +850,7 @@ void Text::insertChar(Cursor & cur, char_type c) static docstring const number_seperators = from_ascii(".,:"); if (cur.current_font.fontInfo().number() == FONT_ON) { - if (!isDigit(c) && !contains(number_operators, c) && + if (!isDigitASCII(c) && !contains(number_operators, c) && !(contains(number_seperators, c) && cur.pos() != 0 && cur.pos() != cur.lastpos() && @@ -858,7 +858,7 @@ void Text::insertChar(Cursor & cur, char_type c) tm.displayFont(pit, cur.pos() - 1).fontInfo().number() == FONT_ON) ) number(cur); // Set current_font.number to OFF - } else if (isDigit(c) && + } else if (isDigitASCII(c) && cur.real_current_font.isVisibleRightToLeft()) { number(cur); // Set current_font.number to ON @@ -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) {