summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeng Xuetian <wengxt@gmail.com>2022-02-08 07:11:25 -0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-12 18:21:38 +0000
commit3e1b87b4e274c55e4fd733376e5a1ed1fbf476e6 (patch)
tree2ef5d261223b1a4ab34e74038326dce13d6ad45d
parent81dbe477382aa18bef1a2c628794ceab5c9f9765 (diff)
Cursor position == 0 should still show the cursor
Otherwise the cursor would be hidden even if preedit is empty. Amends 719a55be13bdadfa659a732755f280e276a894bd Change-Id: I320733b917779b7b51aa4a28eaea411fdb10a318 Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit 31ae194e295651d9ece03408630d2358acd4f7b4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/shared/qwaylandinputmethodeventbuilder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/qwaylandinputmethodeventbuilder.cpp b/src/shared/qwaylandinputmethodeventbuilder.cpp
index 3910763cb..0d34f5ff7 100644
--- a/src/shared/qwaylandinputmethodeventbuilder.cpp
+++ b/src/shared/qwaylandinputmethodeventbuilder.cpp
@@ -160,9 +160,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()));
}