]> git.lyx.org Git - lyx.git/commitdiff
Consider insets that are chars in InsetCollapsable::getNewLabel()
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 6 Sep 2017 08:02:51 +0000 (10:02 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 6 Sep 2017 08:02:51 +0000 (10:02 +0200)
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

index fb3f23f8cbdea056edc6cab1bf21e66fda4f0a97..ab84cc9c7d267f519f8c59ed99563317ddd9bf10 100644 (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;
 }