summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r--src/gui/text/qtextlayout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index ad00396553..5056319b9d 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2501,7 +2501,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
}
int lineEnd = line.from + line.length + line.trailingSpaces;
- int pos = *cursorPos;
+ int pos = qBound(0, *cursorPos, lineEnd);
int itm;
const QCharAttributes *attributes = eng->attributes();
if (!attributes) {