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) { 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;