summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-02-04 13:55:50 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-02-04 13:55:50 (GMT)
commit47322c3e9eddeeb68d49445507af2d7cf154f3c7 (patch)
treed86c24071d4aaaa1ded75e5d6ee6682f9cb34847 /src/gui/widgets
parent5ee75c4a483405180788b5a4986dce2cf9360d86 (diff)
parentbc331aca61a2f212a347708c9d44a4fb092183fd (diff)
downloadQt-47322c3e9eddeeb68d49445507af2d7cf154f3c7.zip
Qt-47322c3e9eddeeb68d49445507af2d7cf154f3c7.tar.gz
Qt-47322c3e9eddeeb68d49445507af2d7cf154f3c7.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qlinecontrol.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 0da4f6a..c7a3913 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -541,10 +541,13 @@ 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 next = cursor + 1;
+ if(next > end())
+ --next;
+ int c = m_textLayout.previousCursorPosition(next, 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);