Skip to content

Commit

Permalink
Fixed browsing files history.
Browse files Browse the repository at this point in the history
This is a regression since 2fed338.

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
  • Loading branch information
deveee committed May 18, 2018
1 parent 7b8f1ff commit 9e746a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/listview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion src/revsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9e746a2

Please sign in to comment.