diff options
author | Jan Arne Petersen <jan.petersen@kdab.com> | 2016-04-18 21:44:57 +0200 |
---|---|---|
committer | Jan Arne Petersen <jan.petersen@kdab.com> | 2016-04-19 08:44:50 +0000 |
commit | c5ab939aa4f2683c7be61e9b788d50526b811ab8 (patch) | |
tree | 168241f2366ce9c74510a91e984a3c219c2f8b47 /src/client/qwaylandinputcontext.cpp | |
parent | bc9eac9800811417697bebf35c5f11b0e852d123 (diff) |
Use function to convert indices for text protocol
Use a proper function instead of left/midRef(index).toUtf8().size().
Makes it more clear what is happening and makes it easier when wayland
text protocol switches from byte-based to unicode character-based indices.
Also rename parameters of existing indexFromWayland() function to be the
same as in the new function.
Change-Id: Ie90abdcb264b74a024e96e041d5daf651920e9e4
Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/client/qwaylandinputcontext.cpp')
-rw-r--r-- | src/client/qwaylandinputcontext.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index f211780fd..af8e6f818 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -157,7 +157,7 @@ void QWaylandTextInput::updateState(Qt::InputMethodQueries queries, uint32_t fla anchor -= offset; } - set_surrounding_text(text, text.leftRef(cursor).toUtf8().size(), text.leftRef(anchor).toUtf8().size()); + set_surrounding_text(text, QWaylandInputMethodEventBuilder::indexToWayland(text, cursor), QWaylandInputMethodEventBuilder::indexToWayland(text, anchor)); } if (queries & Qt::ImHints) { |