forked from qt-creator/qt-creator
DiffEditor: fix jumping to selected file from toolbar dropdown
Change-Id: I968ddc798c6f66072947031bab2dd3855a99bdee Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -2973,6 +2973,11 @@ bool PlainTextEdit::find(const QRegularExpression &exp, QTextDocument::FindFlags
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void PlainTextEdit::setTopBlock(const QTextBlock &block)
|
||||||
|
{
|
||||||
|
d->setTopBlock(block.firstLineNumber(), 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void PlainTextEdit::copyAvailable(bool yes)
|
\fn void PlainTextEdit::copyAvailable(bool yes)
|
||||||
|
|
||||||
|
@@ -111,6 +111,7 @@ public:
|
|||||||
inline QString toPlainText() const
|
inline QString toPlainText() const
|
||||||
{ return document()->toPlainText(); }
|
{ return document()->toPlainText(); }
|
||||||
|
|
||||||
|
void setTopBlock(const QTextBlock &block);
|
||||||
void ensureCursorVisible();
|
void ensureCursorVisible();
|
||||||
|
|
||||||
virtual QVariant loadResource(int type, const QUrl &name);
|
virtual QVariant loadResource(int type, const QUrl &name);
|
||||||
|
@@ -834,7 +834,7 @@ void SideBySideDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
|
|||||||
QTextCursor cursor = editor->textCursor();
|
QTextCursor cursor = editor->textCursor();
|
||||||
cursor.setPosition(block.position());
|
cursor.setPosition(block.position());
|
||||||
editor->setTextCursor(cursor);
|
editor->setTextCursor(cursor);
|
||||||
editor->verticalScrollBar()->setValue(blockNumber);
|
editor->setTopBlock(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -578,7 +578,7 @@ void UnifiedDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
|
|||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
cursor.setPosition(block.position());
|
cursor.setPosition(block.position());
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
verticalScrollBar()->setValue(blockNumber);
|
setTopBlock(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace DiffEditor::Internal
|
} // namespace DiffEditor::Internal
|
||||||
|
Reference in New Issue
Block a user