Fixed handling of text wrapping and a text layout corner case

Due to using QTextCursor::columnNumber() instead of
QTextCursor::positionInBlock(), a lot of code would not work correctly
when used with wrapped lines.

In addition, there was an issue with columnNumber() returning 0 right
after inserting a character before the last character of a line.

Reviewed-by: mae
This commit is contained in:
Thorbjørn Lindeijer
2010-06-15 10:44:07 +02:00
parent c44a0e5999
commit a6e5298591
9 changed files with 12 additions and 12 deletions

View File

@@ -192,7 +192,7 @@ bool TabSettings::tabShouldIndent(const QTextDocument *document, QTextCursor cur
return true;
if (document->characterAt(tc.position()).isSpace()) {
tc.movePosition(QTextCursor::WordRight);
if (tc.columnNumber() >= cursor.columnNumber()) {
if (tc.positionInBlock() >= cursor.positionInBlock()) {
if (suggestedPosition)
*suggestedPosition = tc.position(); // Suggest position after whitespace
if (m_tabKeyBehavior == TabLeadingWhitespaceIndents)