mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-29 22:48:24 +02:00
Implement state filtering for commit files
This commit is contained in:
committed by
Jesse Duffield
parent
bdea3b7dcf
commit
2dc6f5f079
@@ -473,6 +473,39 @@ func (gui *Gui) handleCommitEditorPress() error {
|
||||
)
|
||||
}
|
||||
|
||||
func (gui *Gui) handleStatusFilterPressed() error {
|
||||
menuItems := []*menuItem{}
|
||||
|
||||
menuItems = append(menuItems, &menuItem{
|
||||
displayString: "Show only staged files",
|
||||
onPress: func() error {
|
||||
return gui.setStatusFiltering(filetree.DisplayStaged)
|
||||
},
|
||||
})
|
||||
|
||||
menuItems = append(menuItems, &menuItem{
|
||||
displayString: "Show only unstaged files",
|
||||
onPress: func() error {
|
||||
return gui.setStatusFiltering(filetree.DisplayUnstaged)
|
||||
},
|
||||
})
|
||||
|
||||
menuItems = append(menuItems, &menuItem{
|
||||
displayString: "Reset Filter",
|
||||
onPress: func() error {
|
||||
return gui.setStatusFiltering(filetree.DisplayAll)
|
||||
},
|
||||
})
|
||||
|
||||
return gui.createMenu(gui.Tr.FilteringMenuTitle, menuItems, createMenuOptions{showCancel: false})
|
||||
}
|
||||
|
||||
func (gui *Gui) setStatusFiltering(filter filetree.FileManagerDisplayFilter) error {
|
||||
state := gui.State
|
||||
state.FileManager.SetDisplayFilter(filter)
|
||||
return gui.handleRefreshFiles()
|
||||
}
|
||||
|
||||
func (gui *Gui) editFile(filename string) error {
|
||||
return gui.editFileAtLine(filename, 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user