mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Do not propose existing labels
This commit is contained in:
parent
86cccf1077
commit
4517c6f9a5
11
src/Text.cpp
11
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user