From b12301828722c33e8606758490b405c2f3054b4b Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 27 Jul 2017 12:35:37 +0300 Subject: [PATCH] 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 --- src/plugins/git/gitplugin.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 1fa2bcb37ce..5070fef544a 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -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(textEditor->widget())) { const int previousFirstLine = widget->firstLineNumber(); if (previousFirstLine > 0)