From 9e746a27591c9977ed3d3e28fdd0d6fc59f5741b Mon Sep 17 00:00:00 2001 From: Deve Date: Fri, 18 May 2018 22:00:45 +0200 Subject: [PATCH] Fixed browsing files history. This is a regression since 2fed338fd4c8c9bf147beeca7018ff2a946dbfb3. We can't just clear current file name, because it's useful in some cases. For example if you browse commits for particular file that was selected in the left panel. As far as I understand the goal is to open "Log" tab when different commit is pressed and open "Diff" tab when different filename is selected. This can be achieved by checking if sha has been changed. Fixes #11 --- src/listview.cpp | 1 - src/revsview.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/listview.cpp b/src/listview.cpp index dd6a8cb8..19dc6c89 100644 --- a/src/listview.cpp +++ b/src/listview.cpp @@ -250,7 +250,6 @@ void ListView::currentChanged(const QModelIndex& index, const QModelIndex&) { SCRef selRev = sha(index.row()); if (st->sha() != selRev) { // to avoid looping st->setSha(selRev); - st->setFileName(""); st->setSelectItem(true); UPDATE_DOMAIN(d); } diff --git a/src/revsview.cpp b/src/revsview.cpp index 3fe871f9..0a2adb7b 100644 --- a/src/revsview.cpp +++ b/src/revsview.cpp @@ -280,7 +280,8 @@ bool RevsView::doUpdate(bool force) { } if (st.isChanged() || force) { // activate log or diff tab depending on file selection - tab()->tabLogDiff->setCurrentIndex(st.fileName().isEmpty() ? 0 : 1); + bool sha_changed = st.sha(true) != st.sha(false); + tab()->tabLogDiff->setCurrentIndex(sha_changed ? 0 : 1); tab()->textEditDiff->centerOnFileHeader(st); }