forked from qt-creator/qt-creator
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:
@@ -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());
|
||||||
|
Reference in New Issue
Block a user