summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions/qwaylandtextinput.cpp
diff options
context:
space:
mode:
authorJan Arne Petersen <jan.petersen@kdab.com>2016-04-18 22:40:07 +0200
committerJan Arne Petersen <jan.petersen@kdab.com>2016-04-19 09:15:30 +0000
commit83001f38500542237cea163d3e03119f5e8a8336 (patch)
treec07d83e31cac02fb0f7f2ba372c85f3353f6bc59 /src/compositor/extensions/qwaylandtextinput.cpp
parentc5ab939aa4f2683c7be61e9b788d50526b811ab8 (diff)
Fix wrong preedit styling indices
Indices of QInputMethodEvent::TextFormat are relative to the preedit string and not the surrounding text. Change-Id: Ia2bd2a8d269e5258059bbad4d3e54f061603c76b Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/compositor/extensions/qwaylandtextinput.cpp')
-rw-r--r--src/compositor/extensions/qwaylandtextinput.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp
index 530627641..5ec203c13 100644
--- a/src/compositor/extensions/qwaylandtextinput.cpp
+++ b/src/compositor/extensions/qwaylandtextinput.cpp
@@ -188,10 +188,10 @@ void QWaylandTextInputPrivate::sendInputMethodEvent(QInputMethodEvent *event)
int index = QWaylandInputMethodEventBuilder::indexToWayland(event->preeditString(), attribute.start);
send_preedit_cursor(focusResource->handle, index);
} else if (attribute.type == QInputMethodEvent::TextFormat) {
- int start = QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, attribute.start);
- int end = QWaylandInputMethodEventBuilder::indexToWayland(currentState->surroundingText, attribute.start + attribute.length);
+ int start = QWaylandInputMethodEventBuilder::indexToWayland(event->preeditString(), attribute.start);
+ int length = QWaylandInputMethodEventBuilder::indexToWayland(event->preeditString(), attribute.length, attribute.start);
// TODO add support for different stylesQWaylandTextInput
- send_preedit_styling(focusResource->handle, start, end - start, preedit_style_default);
+ send_preedit_styling(focusResource->handle, start, length, preedit_style_default);
}
}
send_preedit_string(focusResource->handle, event->preeditString(), event->preeditString());