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

QPlainTextEdit garbles displayed text when using word wrap + non-breaking space + additional formats

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.4.2, 5.5.0, 5.6.0, 5.6.1, 5.7.0
    • None
    • Linux x64 but happens on all OSes

    Description

      When word wrapping occurs on a word that is followed by a non-breaking space and the non-breaking space has some additional formatting applied to it, the first two characters from the word are not displayed by QPlainTextEdit.
      See the attached demo program and screenshot.

      Run the demo program (which is a minimal test case) and resize the window so that the word badly gets pushed to a second line. Note that the first two characters "ba" are no longer displayed (they appear to have been clipped).

      This does not happen if the additional format is not applied. In the demo the additional formatting is a red background for the non-breaking space character, but the actual formatting does not matter, it happens even with an empty format.

      This bug happens with both QPlainTextEdit and QTextEdit, which likely means that the actual bug is in QTextLayout.

      Attachments

        1. badly.png
          badly.png
          3 kB
        2. QtBugNonBreakingSpace.zip
          4 kB
        3. test.zip
          0.8 kB

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              kovid Kovid Goyal
              Votes:
              7 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes