Only elide label of hyperlink inset if target and not name given

Øystein Senneset Haaland oystein.s.haaland at gmail.com
Sat Mar 21 22:14:48 UTC 2020


When I add a URL as a hyperlink inset and give it a name, I normally would
like to see the full text of the name in the label. This way, it can to a
greater extent be part of the surrounding text.

The patch is simple; it only moves the eliding part up where its only the
target that is set, not the name:

diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp
index a500f7bd59..ffa25b9f23 100644
--- a/src/insets/InsetHyperlink.cpp
+++ b/src/insets/InsetHyperlink.cpp
@@ -65,15 +65,16 @@ docstring InsetHyperlink::screenLabel() const
        docstring url;

        url += getParam("name");
-       if (url.empty())
+       if (url.empty()) {
                url += getParam("target");
-
-       // elide if long
-       if (url.length() > 30) {
-               docstring end = url.substr(url.length() - 17, url.length());
-               support::truncateWithEllipsis(url, 13);
-               url += end;
-       }
+
+        // elide if long
+        if (url.length() > 30) {
+            docstring end = url.substr(url.length() - 17, url.length());
+            support::truncateWithEllipsis(url, 13);
+            url += end;
+        }
+    }
        return temp + url;
 }

---

Øystein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20200321/dac3016d/attachment.html>


More information about the lyx-devel mailing list