Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24801

Trailing white space on wrapped right to left text doesn't scroll TextInput.

    XMLWordPrintable

Details

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes