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:
Tobias Hunger
2015-04-16 15:31:25 +02:00
parent 804a573105
commit 5c60bb9dd5
2 changed files with 4 additions and 3 deletions

View File

@@ -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;
}