Git: Fix blame with selection that ends on the last line

This also removes an additional line when the cursor is on a line start.

Change-Id: Iaec6f60b8e33d98c3a3ed0555ee4ff01991ad7fb
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Orgad Shaneh
2017-07-27 12:35:37 +03:00
committed by Orgad Shaneh
parent 3e214a2ebd
commit b123018287

View File

@@ -716,9 +716,11 @@ void GitPlugin::blameFile()
cursor.setPosition(selectionStart);
const int startBlock = cursor.blockNumber();
cursor.setPosition(selectionEnd);
const int endBlock = cursor.blockNumber();
int endBlock = cursor.blockNumber();
if (startBlock != endBlock) {
firstLine = startBlock + 1;
if (cursor.atBlockStart())
--endBlock;
if (auto widget = qobject_cast<VcsBaseEditorWidget *>(textEditor->widget())) {
const int previousFirstLine = widget->firstLineNumber();
if (previousFirstLine > 0)