mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-04 10:34:55 +02:00
show branches context when starting in filtering mode
This commit is contained in:
parent
ee7b634dce
commit
7bc6dc5cf3
@ -54,9 +54,9 @@ type ContextManager struct {
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func NewContextManager(contexts ContextTree) ContextManager {
|
||||
func NewContextManager(initialContext Context) ContextManager {
|
||||
return ContextManager{
|
||||
ContextStack: []Context{contexts.Files},
|
||||
ContextStack: []Context{initialContext},
|
||||
Mutex: sync.Mutex{},
|
||||
}
|
||||
}
|
||||
@ -366,13 +366,15 @@ func (gui *Gui) resetState(filterPath string) {
|
||||
|
||||
showTree := gui.Config.GetUserConfig().Gui.ShowFileTree
|
||||
|
||||
contexts := gui.contextTree()
|
||||
|
||||
screenMode := SCREEN_NORMAL
|
||||
initialContext := contexts.Files
|
||||
if filterPath != "" {
|
||||
screenMode = SCREEN_HALF
|
||||
initialContext = contexts.BranchCommits
|
||||
}
|
||||
|
||||
contexts := gui.contextTree()
|
||||
|
||||
gui.State = &guiState{
|
||||
FileManager: filetree.NewFileManager(make([]*models.File, 0), gui.Log, showTree),
|
||||
CommitFileManager: filetree.NewCommitFileManager(make([]*models.CommitFile, 0), gui.Log, showTree),
|
||||
@ -406,7 +408,7 @@ func (gui *Gui) resetState(filterPath string) {
|
||||
SideView: nil,
|
||||
Ptmx: nil,
|
||||
Modes: Modes{
|
||||
Filtering: filtering.NewFiltering(),
|
||||
Filtering: filtering.NewFiltering(filterPath),
|
||||
CherryPicking: CherryPicking{
|
||||
CherryPickedCommits: make([]*models.Commit, 0),
|
||||
ContextKey: "",
|
||||
@ -417,7 +419,7 @@ func (gui *Gui) resetState(filterPath string) {
|
||||
ViewTabContextMap: contexts.initialViewTabContextMap(),
|
||||
ScreenMode: screenMode,
|
||||
// TODO: put contexts in the context manager
|
||||
ContextManager: NewContextManager(contexts),
|
||||
ContextManager: NewContextManager(initialContext),
|
||||
Contexts: contexts,
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@ type Filtering struct {
|
||||
path string // the filename that gets passed to git log
|
||||
}
|
||||
|
||||
func NewFiltering() Filtering {
|
||||
return Filtering{path: ""}
|
||||
func NewFiltering(path string) Filtering {
|
||||
return Filtering{path: path}
|
||||
}
|
||||
|
||||
func (m *Filtering) Active() bool {
|
||||
|
Loading…
Reference in New Issue
Block a user