Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.8.4, 5.0.0
-
d4b30757ab2f66e351a73f087b834d578d21ea15
Description
If you activate QTextOption::ShowLineAndParagraphSeparators on a QTextDocument and have spaces in a line, the last characters in that line are not shown.
If you have the following line:
1 23 456789
the text you see is:
1 23 4567
Only the last consecutive spaces matter. And for each space a character at the end of the line gets hidden (including the linebreak symbol).
If you use a TextEdit the navigation and selection behaviour is also broken.
Pressing 'End' on the line will move the cursor to the previous to last visible character. But if you use the cursor keys you can move to the real end of the line.
Example:
QTextEdit *textEdit = new QTextEdit; QTextOption option = textEdit->document()->defaultTextOption(); option.setFlags( option.flags() | QTextOption::ShowTabsAndSpaces | QTextOption::ShowLineAndParagraphSeparators ); textEdit->document()->setDefaultTextOption( option ); textEdit->setPlainText( QLatin1String("1234567890\n" "1 2 3 4 5 6 7 8 9 0\n" "1 2 3 4 5 67890\n") ); textEdit->show();
The result can be seen in the attached image.