diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-16 10:05:45 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 0ea0c486310558e26af7ad6e4fcf17f57c2b62e3 (patch) | |
tree | eef43cc81d0ea0741e42056ff1c7a33716e8fe09 /pkg/gui/context.go | |
parent | cec4cb48cb8d4ba6ed3def0194f4443a1fc51cbd (diff) |
WIP
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r-- | pkg/gui/context.go | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index bf3ec2778..06664571f 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -1,5 +1,9 @@ package gui +import ( + "github.com/jesseduffield/lazygit/pkg/gui/stack" +) + // changeContext is a helper function for when we want to change a 'main' context // which currently just means a context that affects both the main and secondary views // other views can have their context changed directly but this function helps @@ -17,3 +21,66 @@ func (gui *Gui) changeMainViewsContext(context string) { gui.State.MainContext = context } + +type contextManager struct { + gui *Gui + stack stack.Stack +} + +func (c *contextManager) push(contextKey string) { + c.stack.Push(contextKey) +} + +// push focus, pop focus. + +type Context interface { + OnFocus() error +} + +type SimpleContext struct { + Self Context +} + +type RemotesContext struct { + Self Context + Branches Context +} + +type CommitsContext struct { + Self Context + Files Context +} + +type ContextTree struct { + Status SimpleContext + Files SimpleContext + Branches SimpleContext + Remotes RemotesContext + Tags SimpleContext + Commits CommitsContext + Stash SimpleContext + Staging SimpleContext + PatchBuilding SimpleContext + Merging SimpleContext + Menu SimpleContext + Credentials SimpleContext + Confirmation SimpleContext + CommitMessage SimpleContext +} + +func (gui *Gui) createContextTree() { + gui.State.Contexts = ContextTree{ + Files: SimpleContext{ + Self: gui.filesListView(), + }, + } +} + +// func (c *contextManager) pop() (string, bool) { +// value, ok := c.stack.Pop() + +// if !ok { +// // bottom of the stack, let's go to the default context: the files context +// c.gui.switchFocus(nil, newView) +// } +// } |