mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
Allow user to switch filter when showing only conflicts
We don't need to maintain additional state to allow this; all we need to do is take over the filter only when the number of conflicting files goes from zero to non-zero, rather than every time it is non-zero. The only problem is that we don't allow users to go back to showing only conflicted files, but that's just because we don't have that as an entry in the menu. And I don't think it's a problem.
This commit is contained in:
parent
a1838d33e7
commit
e883f74f3c
@ -588,15 +588,11 @@ func (self *RefreshHelper) refreshStateFiles() error {
|
||||
fileTreeViewModel.RWMutex.Lock()
|
||||
|
||||
// only taking over the filter if it hasn't already been set by the user.
|
||||
// Though this does make it impossible for the user to actually say they want to display all if
|
||||
// conflicts are currently being shown. Hmm. Worth it I reckon. If we need to add some
|
||||
// extra state here to see if the user's set the filter themselves we can do that, but
|
||||
// I'd prefer to maintain as little state as possible.
|
||||
if conflictFileCount > 0 {
|
||||
if conflictFileCount > 0 && prevConflictFileCount == 0 {
|
||||
if fileTreeViewModel.GetFilter() == filetree.DisplayAll {
|
||||
fileTreeViewModel.SetStatusFilter(filetree.DisplayConflicted)
|
||||
}
|
||||
} else if fileTreeViewModel.GetFilter() == filetree.DisplayConflicted {
|
||||
} else if conflictFileCount == 0 && fileTreeViewModel.GetFilter() == filetree.DisplayConflicted {
|
||||
fileTreeViewModel.SetStatusFilter(filetree.DisplayAll)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user