From 0134685622c73f56aad52a41187a5dd8eec44d2a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 23 Jun 2021 15:55:03 +0400 Subject: [PATCH] Fix converting entities to tags. --- ui/text/text_entity.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/text/text_entity.cpp b/ui/text/text_entity.cpp index 1824cb9..b183ac8 100644 --- a/ui/text/text_entity.cpp +++ b/ui/text/text_entity.cpp @@ -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) { - result.push_back({ offset, nextOffset - offset, current }); + if (!current.isEmpty()) { + result.push_back({ offset, nextOffset - offset, current }); + } offset = nextOffset; } current = next;