summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlinecontrol.cpp
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-01-10 05:01:11 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2011-01-10 05:01:11 (GMT)
commit77cba04c244c47c77af04777de3b3172c309b541 (patch)
tree1536d5004815033667ae59f5d2b1b187907cd5b3 /src/gui/widgets/qlinecontrol.cpp
parentcbf6bfbff8c0643bc82bb2456214994931052bd6 (diff)
downloadQt-77cba04c244c47c77af04777de3b3172c309b541.zip
Qt-77cba04c244c47c77af04777de3b3172c309b541.tar.gz
Qt-77cba04c244c47c77af04777de3b3172c309b541.tar.bz2
Fix word selection in QLineControl
Word selection occasionally selected the word beforehand as well, in both QLineEdit and TextInput. Visual Test included to verify behavior. Task-number: QTBUG-15818 Reviewed-by: Martin Jones
Diffstat (limited to 'src/gui/widgets/qlinecontrol.cpp')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 5ea9dc4..12607c1 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -541,10 +541,10 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
*/
void QLineControl::selectWordAtPos(int cursor)
{
- int c = m_textLayout.previousCursorPosition(cursor, QTextLayout::SkipWords);
+ int c = m_textLayout.previousCursorPosition(cursor+1, QTextLayout::SkipWords);
moveCursor(c, false);
// ## text layout should support end of words.
- int end = m_textLayout.nextCursorPosition(cursor, QTextLayout::SkipWords);
+ int end = m_textLayout.nextCursorPosition(c, QTextLayout::SkipWords);
while (end > cursor && m_text[end-1].isSpace())
--end;
moveCursor(end, true);