Commit 165f759e authored by Ulf Hermann's avatar Ulf Hermann Committed by hjk
Browse files

Editors: sync the layout with the contents before setting text cursor



Not doing this makes the QPlainTextEdit interact with an invalid
layout, potentially causing crashes. Now the cursor setting itself is
not part of the undo stack anymore, but as undoing sets the cursor
itself, that shouldn't be a problem.

Change-Id: Ic6f8ee9781faed655ac20f058b562c098ced20ae
Task-number: QTCREATORBUG-12987
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 60274695
......@@ -223,6 +223,8 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
}
}
cursor.endEditBlock();
// adjust selection when commenting out
if (hasSelection && !doMultiLineStyleUncomment && !doSingleLineStyleUncomment) {
cursor = edit->textCursor();
......@@ -238,6 +240,4 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
}
edit->setTextCursor(cursor);
}
cursor.endEditBlock();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment