commit ab75926bda3729474e4712352d1b53bf3a8d44f2
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Fri May 23 15:42:12 2025 +0200

    Improve display of reference lists in workarea
---
 src/insets/InsetRef.cpp | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 0279f7f39d..deea20a413 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -690,10 +690,29 @@ docstring InsetRef::displayString(docstring const & ref, 
string const & cmd,
                        display_string.push_back(ref);
                first = false;
        }
-       docstring res = (useRange()) ? getStringFromVector(display_string, 
from_utf8("–"))
-                                    : getStringFromVector(display_string, 
from_ascii(", "));
+       if (useRange())
+               return getStringFromVector(display_string, from_utf8("–"));
+
+       odocstringstream os;
+       first = true;
+       vector<docstring>::const_iterator it = display_string.begin();
+       vector<docstring>::const_iterator en = display_string.end();
+       for (size_t i = 0; it != en; ++it, ++i) {
+               if (first) {
+                       os << *it;
+                       first = false;
+                       continue;
+               }
+               if (display_string.size() == 2)
+                       os << buffer().B_("[[reference 1]] and [[reference2]]");
+               else if (i > 0 && i == display_string.size() - 1)
+                       os << buffer().B_("[[reference 1, ...]], and 
[[reference n]]");
+               else
+                       os << buffer().B_("[[reference 1]], [[reference2, 
...]]");
+               os << *it;
+       }
 
-       return res;
+       return os.str();
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to