Consider insets that are chars in InsetCollapsable::getNewLabel()

This fixes the display of closed ERTs, Indexes etc. when they contain
special chars, logos or quotation marks.

(Since quotation marks in ERTs are now insets, not chars anymore,
this also fixes a bug/regression of the display of babel shortcuts
such as "= in closed ERTs; hence I consider this fix necessary for 2.3.x)
This commit is contained in:
Juergen Spitzmueller 2017-09-06 10:02:51 +02:00
parent 103e17da90
commit eb51d60571

View File

@ -416,22 +416,26 @@ bool InsetCollapsable::clickable(BufferView const & bv, int x, int y) const
docstring const InsetCollapsable::getNewLabel(docstring const & l) const
{
docstring label;
odocstringstream label;
pos_type const max_length = 15;
pos_type const p_siz = paragraphs().begin()->size();
pos_type const n = min(max_length, p_siz);
pos_type i = 0;
pos_type j = 0;
for (; i < n && j < p_siz; ++j) {
if (paragraphs().begin()->isInset(j))
continue;
label += paragraphs().begin()->getChar(j);
if (paragraphs().begin()->isInset(j)) {
if (!paragraphs().begin()->getInset(j)->isChar())
continue;
paragraphs().begin()->getInset(j)->toString(label);
} else
label.put(paragraphs().begin()->getChar(j));
++i;
}
if (paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
label += "...";
label << "...";
}
return label.empty() ? l : label;
docstring const lbl = label.str();
return lbl.empty() ? l : lbl;
}