summaryrefslogtreecommitdiffstats
path: root/src/widgets/to_be_moved/qlinecontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/to_be_moved/qlinecontrol.cpp')
-rw-r--r--src/widgets/to_be_moved/qlinecontrol.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/to_be_moved/qlinecontrol.cpp b/src/widgets/to_be_moved/qlinecontrol.cpp
index ee7d7fb126..bf36033c08 100644
--- a/src/widgets/to_be_moved/qlinecontrol.cpp
+++ b/src/widgets/to_be_moved/qlinecontrol.cpp
@@ -435,6 +435,8 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
c += event->commitString().length() - qMin(-event->replacementStart(), event->replacementLength());
m_cursor += event->replacementStart();
+ if (m_cursor < 0)
+ m_cursor = 0;
// insert commit string
if (event->replacementLength()) {
@@ -447,7 +449,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
cursorPositionChanged = true;
}
- m_cursor = qMin(c, m_text.length());
+ m_cursor = qBound(0, c, m_text.length());
for (int i = 0; i < event->attributes().size(); ++i) {
const QInputMethodEvent::Attribute &a = event->attributes().at(i);