Fix converting entities to tags.
This commit is contained in:
parent
a009efc50d
commit
0134685622
1 changed files with 5 additions and 3 deletions
|
|
@ -2060,8 +2060,8 @@ QString TagWithRemoved(const QString &tag, const QString &removed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TagWithAdded(const QString &tag, const QString &added) {
|
QString TagWithAdded(const QString &tag, const QString &added) {
|
||||||
if (tag == added) {
|
if (tag.isEmpty() || tag == added) {
|
||||||
return tag;
|
return added;
|
||||||
}
|
}
|
||||||
auto list = tag.splitRef('|');
|
auto list = tag.splitRef('|');
|
||||||
const auto ref = added.midRef(0);
|
const auto ref = added.midRef(0);
|
||||||
|
|
@ -2227,7 +2227,9 @@ TextWithTags::Tags ConvertEntitiesToTextTags(
|
||||||
if (next == current) {
|
if (next == current) {
|
||||||
return;
|
return;
|
||||||
} else if (nextOffset > offset) {
|
} else if (nextOffset > offset) {
|
||||||
result.push_back({ offset, nextOffset - offset, current });
|
if (!current.isEmpty()) {
|
||||||
|
result.push_back({ offset, nextOffset - offset, current });
|
||||||
|
}
|
||||||
offset = nextOffset;
|
offset = nextOffset;
|
||||||
}
|
}
|
||||||
current = next;
|
current = next;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue