The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 4517c6f9a5fc00c4bd21e3c1fd27ac72f36ffae6
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Sep 19 10:20:19 2012 +0200

    Do not propose existing labels

diff --git a/src/Text.cpp b/src/Text.cpp
index a2f6992..c61e9e1 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -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"
@@ -1955,7 +1956,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;
 }
 
 

-----------------------------------------------------------------------

Summary of changes:
 src/Text.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to