forked from qt-creator/qt-creator
DiffEditor: When jumping to a file then put that block to the top
When jumping to a file via the dropdown box: Have that block be scrolled to the top of the view, not to the center. This is way less confusing. Change-Id: I5c629dda1af8bff76ca93a70357aa35c8efcb37a Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -631,14 +631,14 @@ void SideBySideDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
|
||||
QTextCursor leftCursor = m_leftEditor->textCursor();
|
||||
leftCursor.setPosition(leftBlock.position());
|
||||
m_leftEditor->setTextCursor(leftCursor);
|
||||
m_leftEditor->verticalScrollBar()->setValue(blockNumber);
|
||||
|
||||
QTextBlock rightBlock = m_rightEditor->document()->findBlockByNumber(blockNumber);
|
||||
QTextCursor rightCursor = m_rightEditor->textCursor();
|
||||
rightCursor.setPosition(rightBlock.position());
|
||||
m_rightEditor->setTextCursor(rightCursor);
|
||||
m_rightEditor->verticalScrollBar()->setValue(blockNumber);
|
||||
|
||||
m_leftEditor->centerCursor();
|
||||
m_rightEditor->centerCursor();
|
||||
m_ignoreCurrentIndexChange = oldIgnore;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user