commit fa2cbb730c1d8c2e84419f6ad6bb77dcd34b5888
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat Jan 7 17:38:25 2017 +0100

    Limit InsetCitation tooltip to sensible length
---
 src/insets/InsetCitation.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index 3972394..34e3785 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -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;

Reply via email to