From eb51d6057197bfca94912bf9da88b4a1b208275a Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 6 Sep 2017 10:02:51 +0200 Subject: [PATCH] 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) --- src/insets/InsetCollapsable.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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; } -- 2.39.2