[LyX/master] Amend 225b5beb47b

Juergen Spitzmueller <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit bab48a45852082780fd0e34f932c65bb45cdf8e7
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Mar 27 10:09:25 2026 +0100

    Amend 225b5beb47b
    
    The previous solution did not work well with subentries
---
 src/insets/InsetIndex.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp
index 09d8790f24..438b3308ef 100644
--- a/src/insets/InsetIndex.cpp
+++ b/src/insets/InsetIndex.cpp
@@ -1137,20 +1137,20 @@ void InsetIndex::addToToc(DocIterator const & cpit, bool output_active,
 	if (!il.contentaslabel())
 		str = label;
 	else {
-		str = getNewLabel(label, TOC_ENTRY_LENGTH);
 		OutputParams const rp(0);
 		vector<docstring> sublbls = getSubentriesAsText(rp, true);
+		docstring sublabel;
 		for (auto const & sublbl : sublbls) {
-			str += " " + docstring(1, char_type(0x2023));// TRIANGULAR BULLET
-			str += " " + sublbl;
+			sublabel += " " + docstring(1, char_type(0x2023));// TRIANGULAR BULLET
+			sublabel += " " + sublbl;
 		}
 		docstring see = getSeeAsText(rp, true);
 		if (see.empty() && !getSeeAlsoesAsText(rp, true).empty())
 			see = getSeeAlsoesAsText(rp, true).front();
-		if (!see.empty()) {
-			str += " " + docstring(1, char_type(0x261e));// WHITE RIGHT POINTING INDEX
-			str += " " + see;
-		}
+		if (!see.empty())
+			see = " " + docstring(1, char_type(0x261e)) + see;// WHITE RIGHT POINTING INDEX
+		int const maxlen = TOC_ENTRY_LENGTH - sublabel.size() - see.size();
+		str = getNewLabel(label, maxlen) + sublabel + see;
 	}
 	string type = "index";
 	if (buffer().masterBuffer()->params().use_indices)
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.