From: Juergen Spitzmueller Date: Wed, 6 Sep 2017 08:02:51 +0000 (+0200) Subject: Consider insets that are chars in InsetCollapsable::getNewLabel() X-Git-Tag: lyx-2.4.0dev-acb2ca7b~4591 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=eb51d6057197bfca94912bf9da88b4a1b208275a;p=features.git 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) --- diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index fb3f23f8cb..ab84cc9c7d 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -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; }