Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
Description
In the example below continuously appending spaces to the end of the first text edit will cause the text to scroll off to the left when the cursor reaches the right boundary of the rectangle.
If the same is done in the second text edit, the text will not scroll when the cursor reaches the left boundary, instead the cursor will move to right boundary.
import QtQuick 2.0 Column { width: 320 height: 480 spacing: 20 TextInput { anchors { left: parent.left; right: parent.right; margins: 5 } text: "hello world" wrapMode: TextInput.Wrap Rectangle { color: "transparent" border.width: 1 anchors { fill: parent; margins: -2 } } } TextInput { anchors { left: parent.left; right: parent.right; margins: 5 } text: "اختبا" wrapMode: TextInput.Wrap Rectangle { color: "transparent" border.width: 1 anchors { fill: parent; margins: -2 } } } }
The problem originates in QTextLine::cursorToX() which returns the lineWidth for whitespace characters outside the specified width for the line when both a wrapMode is set and the layoutDirection is RightToLeft.
The text input scrolls correctly if the line width is exceeded because of non breaking characters.