Help/litehtml: Fix text search in presence of multi-byte characters

std::string::size is returning byte-count, not character count, in
contrast to QString::size. Do not mix.

Fixes: QTCREATORBUG-22970
Change-Id: I865ca0c13a08fb500b6526ba6ee3207359e75107
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2019-09-24 14:39:20 +02:00
parent 3b2209b870
commit 284eab836c

View File

@@ -641,8 +641,9 @@ void DocumentContainer::buildIndex()
current->get_text(text); current->get_text(text);
if (!text.empty()) { if (!text.empty()) {
m_index.indexToElement.push_back({index, current}); m_index.indexToElement.push_back({index, current});
m_index.text += QString::fromStdString(text); const QString str = QString::fromStdString(text);
index += text.size(); m_index.text += str;
index += str.size();
} }
} }
current = nextLeaf(current, m_document->root()); current = nextLeaf(current, m_document->root());