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

REG: Selecting text inside a TextEdit causes existing lines to disappear and empty lines to appear.

    XMLWordPrintable

Details

    • macOS
    • b271755e6c (qt/qtdeclarative/dev) d199a95757 (qt/qtdeclarative/6.4) 73746b6562 (qt/qtdeclarative/6.3) 51e14cf31f (qt/qtdeclarative/6.3.2) 51e14cf31f (qt/tqtc-qtdeclarative/6.3.2)

    Description

      We are running latest build of Qt.

      I noticed a strange behavior in TextEdit:

        If you concatenate the string and assign it to text property of TextEdit, and when trying to select those text - in a result some new empty lines appear in the TextEdit.

      Also very important thing is :

      In the end of each line of text i am concatenated there is an escape symbol ("\n") and the number of empty lines are equal to number of lines you trying to select.
      So somehow that escape symbol not taking to account when the text is selecting, causing  creating empty lines.

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          id: root
          width: 640
          height: 480
          visible: true
          color: "#333"
      
          property int sampleCounter
          property string sampleText
      
          readonly property Timer updateTimer: Timer {
              interval: 100;
              running: true
              repeat: true
              onTriggered: {
                  sampleText += "New Text line " + sampleCounter++ + "\n"
              }
          }
      
          Column {
              anchors.fill: parent
              Button {
                  text: updateTimer.running ? "Pause Updates" : "Start Updates"
                  onClicked: updateTimer.running = !updateTimer.running
              }
      
              TextEdit {
                  width: parent.width
                  text: sampleText
                  selectByMouse: true
                  selectByKeyboard: true
              }
          }
      }
      

      Minimal reproduction code is added, as well as small video.

      Thank you.

      With Best Regards

       

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              duodargel.cordeperil Siarhei Darhel
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes