diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-21 19:53:45 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-08-23 14:29:18 +1000 |
commit | 2d90e1e8ee5ccb3d2acd8678e68137645c9e65bd (patch) | |
tree | cb623a51873bd086967ea794b21210861ce5031e /pkg/gui/list_context.go | |
parent | ddf25e14afe5ddfc2527149c54ea55ea2e83610a (diff) |
commit files kind of generalised
Diffstat (limited to 'pkg/gui/list_context.go')
-rw-r--r-- | pkg/gui/list_context.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index f70c202b7..ba2b41962 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -20,12 +20,28 @@ type ListContext struct { RendersToMainView bool Kind int ParentContext Context + WindowName string } type ListItem interface { ID() string } +func (lc *ListContext) SetWindowName(windowName string) { + lc.WindowName = windowName +} + +func (lc *ListContext) GetWindowName() string { + windowName := lc.WindowName + + if windowName != "" { + return windowName + } + + // TODO: actually set this for everything so we don't default to the view name + return lc.ViewName +} + func (lc *ListContext) SetParentContext(c Context) { lc.ParentContext = c } @@ -371,6 +387,7 @@ func (gui *Gui) stashListContext() *ListContext { func (gui *Gui) commitFilesListContext() *ListContext { return &ListContext{ ViewName: "commitFiles", + WindowName: "commits", ContextKey: COMMIT_FILES_CONTEXT_KEY, GetItemsLength: func() int { return len(gui.State.CommitFiles) }, GetPanelState: func() IListPanelState { return gui.State.Panels.CommitFiles }, |