Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.2.1
-
None
-
Windows 7, VS 2010
Description
When drawing a line contains only spaces and has any selections using QTextLayout::draw(), no selection is shown.
To solve this problem, I've corrected QTextLayout and QTextEngine as following.
- QTextLayout.cpp / line 1088
original code : int sl_length = sl.length + (isLastLineInBlock? 1 : 0); // the infamous newline
modified code : int sl_length = sl.length + sl.trailingSpaces + (isLastLineInBlock? 1 : 0); // the infamous newline
- QTextLayout.cpp / line 1097
original : if (sl.length && (selectionStartInLine || selectionEndInLine)) {
modified : if (sl_length && (selectionStartInLine || selectionEndInLine)) {
- QTextEngine.cpp / line 3484
original : lineEnd(line.from + line.length),
modified : lineEnd(line.from + line.length + line.trailingSpaces),
Of course I know I may not consider all cases, but I think that above codes can help error correction.