// FIXME: There should be a more intelligent way to generate and use the
// paragraph ids per buffer instead a global static counter for all InsetText
// in the running program.
+// However, this per-session id is used in LFUN_PARAGRAPH_GOTO to
+// switch to a different buffer, as used in the outliner for instance.
static int paragraph_id = -1;
Paragraph::Private::Private(Private const & p, Paragraph * owner)
{
// FIXME: modifying i here is not very nice...
- // We only arrive here when a proper language for character text_[i] has
- // not been specified (i.e., it could not be translated in the current
- // latex encoding) or its latex translation has been forced, and it
- // belongs to a known script.
+ // We only arrive here when character text_[i] could not be translated
+ // into the current latex encoding (or its latex translation has been forced,)
+ // and it belongs to a known script.
+ // TODO: We need \textcyr and \textgreek wrappers also for characters
+ // that can be encoded in the "LaTeX encoding" but not in the
+ // current *font encoding*.
+ // (See #9681 for details and test)
// Parameter ltx contains the latex translation of text_[i] as specified
// in the unicodesymbols file and is something like "\textXXX{<spec>}".
// The latex macro name "textXXX" specifies the script to which text_[i]
bool closing_brace = true;
if (script == "textgreek" && encoding.latexName() == "iso-8859-7") {
// Correct encoding is being used, so we can avoid \textgreek.
+ // TODO: wrong test: we need to check the *font encoding*
+ // (i.e. the active language and its FontEncoding tag)
+ // instead of the LaTeX *input encoding*!
+ // See #9637 for details and test-cases.
pos = brace1 + 1;
length -= pos;
closing_brace = false;
return;
// If T1 font encoding is used, use the special
// characters it provides.
- // NOTE: Some languages reset the font encoding internally.
- // If we are using such a language, we do not output
- // special T1 chars.
+ // NOTE: Some languages reset the font encoding internally to a
+ // non-standard font encoding. If we are using such a language,
+ // we do not output special T1 chars.
if (!runparams.inIPA && !running_font.language()->internalFontEncoding()
&& bparams.font_encoding() == "T1" && latexSpecialT1(c, os, i, column))
return;
docstring parent(fmt, i + 1, j - i - 1);
docstring label = from_ascii("??");
if (tclass.hasLayout(parent))
- docstring label = expandParagraphLabel(tclass[parent], bparams,
+ label = expandParagraphLabel(tclass[parent], bparams,
process_appendix);
fmt = docstring(fmt, 0, i) + label
+ docstring(fmt, j + 1, docstring::npos);
pos_type end = size();
if (i < end && !(isNewline(i) || isEnvSeparator(i))) {
++i;
- char_type previous_char = 0;
- char_type temp = 0;
if (i < end) {
- previous_char = d->text_[i];
+ char_type previous_char = d->text_[i];
if (!(isNewline(i) || isEnvSeparator(i))) {
++i;
while (i < end && previous_char != ' ') {
- temp = d->text_[i];
+ char_type temp = d->text_[i];
if (isNewline(i) || isEnvSeparator(i))
break;
++i;
corrected_env(os, begin_tag, "flushright", code, lastpar, column);
break;
} case LYX_ALIGN_RIGHT: {
- string output;
if (owner_->getParLanguage(bparams)->babel() != "hebrew")
corrected_env(os, begin_tag, "flushright", code, lastpar, column);
else
if (allowcust && d->endTeXParParams(bparams, os, runparams)
&& runparams.encoding != prev_encoding) {
runparams.encoding = prev_encoding;
- if (!runparams.isFullUnicode())
+ if (!runparams.isFullUnicode()) // FIXME: test for UseTeXFonts
os << setEncoding(prev_encoding->iconvName());
}
}
-void Paragraph::forOutliner(docstring & os, size_t maxlen) const
+void Paragraph::forOutliner(docstring & os, size_t const maxlen,
+ bool const shorten) const
{
+ size_t tmplen = shorten ? maxlen + 1 : maxlen;
if (!d->params_.labelString().empty())
os += d->params_.labelString() + ' ';
- for (pos_type i = 0; i < size() && os.length() < maxlen; ++i) {
+ for (pos_type i = 0; i < size() && os.length() < tmplen; ++i) {
if (isDeleted(i))
continue;
char_type const c = d->text_[i];
else if (c == '\t' || c == '\n')
os += ' ';
else if (c == META_INSET)
- getInset(i)->forOutliner(os, maxlen);
+ getInset(i)->forOutliner(os, tmplen, false);
}
+ if (shorten)
+ Text::shortenForOutliner(os, maxlen);
}