]> git.lyx.org Git - lyx.git/commitdiff
Let hyperlink insets to be longer if name is given.
authorPavel Sanda <sanda@lyx.org>
Wed, 25 Mar 2020 06:40:27 +0000 (07:40 +0100)
committerPavel Sanda <sanda@lyx.org>
Wed, 25 Mar 2020 06:40:27 +0000 (07:40 +0100)
Thanks to Oystein Senneset Haaland.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210882.html

src/insets/InsetHyperlink.cpp

index a500f7bd5913b35d7ea54c226e56826af4eeab9e..a225a8eb0bd55fbd94fc1ddec7d53f6906006f5e 100644 (file)
@@ -60,19 +60,28 @@ ParamInfo const & InsetHyperlink::findInfo(string const & /* cmdName */)
 
 docstring InsetHyperlink::screenLabel() const
 {
+       // TODO: replace with unicode hyperlink character = U+1F517
        docstring const temp = _("Hyperlink: ");
 
        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 and no name was provided
+               if (url.length() > 30) {
+                       docstring end = url.substr(url.length() - 17, url.length());
+                       support::truncateWithEllipsis(url, 13);
+                       url += end;
+               }
+       } else {
+               // elide if long (approx number of chars in line of article class)
+               if (url.length() > 80) {
+                       docstring end = url.substr(url.length() - 67, url.length());
+                       support::truncateWithEllipsis(url, 13);
+                       url += end;
+               }
        }
        return temp + url;
 }