Fix converting entities to tags.

This commit is contained in:
John Preston 2021-06-23 15:55:03 +04:00
parent a009efc50d
commit 0134685622

View file

@ -2060,8 +2060,8 @@ QString TagWithRemoved(const QString &tag, const QString &removed) {
}
QString TagWithAdded(const QString &tag, const QString &added) {
if (tag == added) {
return tag;
if (tag.isEmpty() || tag == added) {
return added;
}
auto list = tag.splitRef('|');
const auto ref = added.midRef(0);
@ -2227,7 +2227,9 @@ TextWithTags::Tags ConvertEntitiesToTextTags(
if (next == current) {
return;
} else if (nextOffset > offset) {
if (!current.isEmpty()) {
result.push_back({ offset, nextOffset - offset, current });
}
offset = nextOffset;
}
current = next;