]> git.lyx.org Git - features.git/commitdiff
Indicate change of content in label of collapsed collapsible
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 29 Dec 2019 08:45:06 +0000 (09:45 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 29 Dec 2019 08:46:18 +0000 (09:46 +0100)
Fixes #8645

src/insets/InsetCollapsible.cpp
src/insets/InsetText.cpp

index 755bb6c30b40e7a11de635f20f0d6d41e775678d..fab5d34864b8bb6817103b5a74a64ce82a40c56b 100644 (file)
@@ -445,9 +445,13 @@ docstring const InsetCollapsible::getNewLabel(docstring const & l) const
        pos_type const n = min(max_length, p_siz);
        pos_type i = 0;
        pos_type j = 0;
+       bool changed_content = false;
        for (; i < n && j < p_siz; ++j) {
-               if (paragraphs().begin()->isDeleted(j))
-                       continue;
+               if (paragraphs().begin()->isChanged(j)) {
+                       changed_content = true;
+                       if (paragraphs().begin()->isDeleted(j))
+                               continue;
+               }
                if (paragraphs().begin()->isInset(j)) {
                        if (!paragraphs().begin()->getInset(j)->isChar())
                                continue;
@@ -459,7 +463,11 @@ docstring const InsetCollapsible::getNewLabel(docstring const & l) const
        if (paragraphs().size() > 1 || (i > 0 && j < p_siz)) {
                label << "...";
        }
-       docstring const lbl = label.str();
+       docstring lbl;
+       // indicate changed content in label (#8645)
+       if (changed_content)
+               lbl = char_type(0x270E);// ✎ U+270E LOWER RIGHT PENCIL
+       lbl += label.str();
        return lbl.empty() ? l : lbl;
 }
 
index 2126fb15b2f6a94f87a4e5e8b66143bfd76dd7a2..c37c1c26d5db3ea4d12b5e2d64ddd08e5380aea2 100644 (file)
@@ -1077,6 +1077,7 @@ docstring InsetText::toolTipText(docstring prefix, size_t const len) const
        ParagraphList::const_iterator end = paragraphs().end();
        ParagraphList::const_iterator it = beg;
        bool ref_printed = false;
+       bool changed_content = false;
 
        for (; it != end; ++it) {
                if (it != beg)
@@ -1084,12 +1085,14 @@ docstring InsetText::toolTipText(docstring prefix, size_t const len) const
                if ((*it).isRTL(buffer().params()))
                        oss << "<div dir=\"rtl\">";
                writePlaintextParagraph(buffer(), *it, oss, rp, ref_printed, len);
-               if ((*it).isRTL(buffer().params()))
-                       oss << "</div>";
+               if ((*it).isChanged(0, (*it).size()))
+                       changed_content = true;
                if (oss.tellp() >= 0 && size_t(oss.tellp()) > len)
                        break;
        }
        docstring str = oss.str();
+       if (changed_content)
+               str += from_ascii("\n\n") + _("[contains tracked changes]");
        support::truncateWithEllipsis(str, len);
        return str;
 }