]> git.lyx.org Git - features.git/commitdiff
Limit InsetCitation tooltip to sensible length
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 7 Jan 2017 16:38:25 +0000 (17:38 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 7 Jan 2017 16:38:25 +0000 (17:38 +0100)
src/insets/InsetCitation.cpp

index 3972394ce23aaeffb611657021e8cffa30aabf1e..34e37854cbec737637497ade94c4cca99ac012e6 100644 (file)
@@ -241,11 +241,21 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
 
        docstring tip;
        tip += "<ol>";
+       int count = 0;
        for (docstring const & key : keys) {
                docstring const key_info = bi.getInfo(key, buffer(), ci);
+               // limit to reasonable size.
+               if (count > 9 && keys.size() > 11) {
+                       tip.push_back(0x2026);// HORIZONTAL ELLIPSIS
+                       tip += "<p>"
+                               + bformat(_("+ %1$d more entries."), int(keys.size() - count))
+                               + "</p>";
+                       break;
+               }
                if (key_info.empty())
                        continue;
                tip += "<li>" + key_info + "</li>";
+               ++count;
        }
        tip += "</ol>";
        return tip;