Cursor position == 0 should still show the cursor

Otherwise the cursor would be hidden even if preedit is empty.
Amends 8b3de53ee666c8ea16c735180a7305df2494b16a

Pick-to: 5.15 6.2 6.3
Change-Id: I320733b917779b7b51aa4a28eaea411fdb10a318
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Weng Xuetian 2022-02-08 07:11:25 -08:00 committed by Liang Qi
parent 40051c3388
commit 0f2af27045

View File

@ -153,9 +153,9 @@ QInputMethodEvent *QWaylandInputMethodEventBuilder::buildPreedit(const QString &
{
QList<QInputMethodEvent::Attribute> attributes;
if (m_preeditCursor <= 0) {
if (m_preeditCursor < 0) {
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, 0, 0, QVariant()));
} else if (m_preeditCursor > 0) {
} else {
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, indexFromWayland(text, m_preeditCursor), 1, QVariant()));
}