]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Fix shaded box UI color (#7395) as good as it gets ATM
[lyx.git] / src / Text.cpp
index a2f69922032510a73c251bddf9bdcd30b61efde2..390b69d7146da96eaf30dcf704caf07011df7fd7 100644 (file)
@@ -60,6 +60,7 @@
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetTabular.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/gettext.h"
@@ -1811,6 +1812,7 @@ bool Text::read(Lexer & lex,
        return res;
 }
 
+
 // Returns the current font and depth as a message.
 docstring Text::currentState(Cursor const & cur) const
 {
@@ -1955,7 +1957,15 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
        if (!name.empty())
                text = name + ':' + text;
 
-       return text;
+       // We need a unique label
+       docstring label = text;
+       int i = 1;
+       while (cur.buffer()->insetLabel(label)) {
+                       label = text + '-' + convert<docstring>(i);
+                       ++i;
+               }
+
+       return label;
 }