forked from qt-creator/qt-creator
Editor: prevent validating line number in unwrapped editor
Checking whether a position is inside the first line is also not for free. Only check the line number of a cursor position if we expect the editor to have multiple lines per block or in other words line wrapping is enabled. Change-Id: I0e3cb1fbd11c250677f7c11d1a5c780f60085ec2 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -4483,8 +4483,10 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data,
|
|||||||
while (paintColumn < depth) {
|
while (paintColumn < depth) {
|
||||||
if (x >= 0) {
|
if (x >= 0) {
|
||||||
int paintPosition = tabSettings.positionAtColumn(text, paintColumn);
|
int paintPosition = tabSettings.positionAtColumn(text, paintColumn);
|
||||||
if (blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0)
|
if (q->lineWrapMode() == QPlainTextEdit::WidgetWidth
|
||||||
|
&& blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
const QPointF top(x, blockData.boundingRect.top());
|
const QPointF top(x, blockData.boundingRect.top());
|
||||||
const QPointF bottom(x, blockData.boundingRect.top() + rect.height());
|
const QPointF bottom(x, blockData.boundingRect.top() + rect.height());
|
||||||
const QLineF line(top, bottom);
|
const QLineF line(top, bottom);
|
||||||
|
Reference in New Issue
Block a user