File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package controllers
22
33import (
44 "errors"
5+ "fmt"
56 "strings"
67
78 "github.com/jesseduffield/gocui"
@@ -801,10 +802,30 @@ func (self *FilesController) handleStatusFilterPressed() error {
801802 })
802803}
803804
805+ func (self * FilesController ) filteringLabel (filter filetree.FileTreeDisplayFilter ) string {
806+ switch filter {
807+ case filetree .DisplayAll :
808+ return ""
809+ case filetree .DisplayStaged :
810+ return self .c .Tr .FilterLabelStagedFiles
811+ case filetree .DisplayUnstaged :
812+ return self .c .Tr .FilterLabelUnstagedFiles
813+ case filetree .DisplayTracked :
814+ return self .c .Tr .FilterLabelTrackedFiles
815+ case filetree .DisplayUntracked :
816+ return self .c .Tr .FilterLabelUntrackedFiles
817+ case filetree .DisplayConflicted :
818+ return self .c .Tr .FilterLabelConflictingFiles
819+ }
820+
821+ panic (fmt .Sprintf ("Unexpected files display filter: %d" , filter ))
822+ }
823+
804824func (self * FilesController ) setStatusFiltering (filter filetree.FileTreeDisplayFilter ) error {
805825 previousFilter := self .context ().GetFilter ()
806826
807827 self .context ().FileTreeViewModel .SetStatusFilter (filter )
828+ self .c .Contexts ().Files .GetView ().Subtitle = self .filteringLabel (filter )
808829
809830 // Whenever we switch between untracked and other filters, we need to refresh the files view
810831 // because the untracked files filter applies when running `git status`.
Original file line number Diff line number Diff line change @@ -591,9 +591,11 @@ func (self *RefreshHelper) refreshStateFiles() error {
591591 if conflictFileCount > 0 && prevConflictFileCount == 0 {
592592 if fileTreeViewModel .GetFilter () == filetree .DisplayAll {
593593 fileTreeViewModel .SetStatusFilter (filetree .DisplayConflicted )
594+ self .c .Contexts ().Files .GetView ().Subtitle = self .c .Tr .FilterLabelConflictingFiles
594595 }
595596 } else if conflictFileCount == 0 && fileTreeViewModel .GetFilter () == filetree .DisplayConflicted {
596597 fileTreeViewModel .SetStatusFilter (filetree .DisplayAll )
598+ self .c .Contexts ().Files .GetView ().Subtitle = ""
597599 }
598600
599601 self .c .Model ().Files = files
Original file line number Diff line number Diff line change @@ -90,6 +90,11 @@ type TranslationSet struct {
9090 FilterTrackedFiles string
9191 FilterUntrackedFiles string
9292 NoFilter string
93+ FilterLabelStagedFiles string
94+ FilterLabelUnstagedFiles string
95+ FilterLabelTrackedFiles string
96+ FilterLabelUntrackedFiles string
97+ FilterLabelConflictingFiles string
9398 MergeConflictsTitle string
9499 Checkout string
95100 CheckoutTooltip string
@@ -1114,6 +1119,11 @@ func EnglishTranslationSet() *TranslationSet {
11141119 FilterTrackedFiles : "Show only tracked files" ,
11151120 FilterUntrackedFiles : "Show only untracked files" ,
11161121 NoFilter : "No filter" ,
1122+ FilterLabelStagedFiles : "(only staged)" ,
1123+ FilterLabelUnstagedFiles : "(only unstaged)" ,
1124+ FilterLabelTrackedFiles : "(only tracked)" ,
1125+ FilterLabelUntrackedFiles : "(only untracked)" ,
1126+ FilterLabelConflictingFiles : "(only conflicting)" ,
11171127 NoChangedFiles : "No changed files" ,
11181128 SoftReset : "Soft reset" ,
11191129 AlreadyCheckedOutBranch : "You have already checked out this branch" ,
You can’t perform that action at this time.
0 commit comments