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

@@ -37,6 +37,7 @@
#include <QPlainTextEdit>
#include <QMenu>
#include <QPlainTextDocumentLayout>
#include <QScrollBar>
#include <QTextBlock>
#include <QTextCodec>
#include <QPainter>
@@ -734,7 +735,7 @@ void UnifiedDiffEditorWidget::setCurrentDiffFileIndex(int diffFileIndex)
QTextCursor cursor = textCursor();
cursor.setPosition(block.position());
setTextCursor(cursor);
centerCursor();
verticalScrollBar()->setValue(blockNumber);
m_ignoreCurrentIndexChange = oldIgnore;
}