summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-03-26 14:33:39 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-26 18:00:46 +1100
commit102c33433b24c9e128d28f5291107fa338e17c8e (patch)
tree333a830b90af3bc75527e2d97a9653b6bfc2c573 /pkg/gui
parentfe87114074ae72e3c548f5b05fb50a919eda0f94 (diff)
remove dead code
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/context.go16
-rw-r--r--pkg/gui/context/context.go32
-rw-r--r--pkg/gui/view_helpers.go2
3 files changed, 24 insertions, 26 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index d78388bf0..8d3d91185 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -430,17 +430,15 @@ func (gui *Gui) setViewTabForContext(c types.Context) {
}
for tabIndex, tabContext := range tabContexts {
- for _, context := range tabContext.Contexts {
- if context.GetKey() == c.GetKey() {
- // get the view, set the tab
- v, err := gui.g.View(c.GetViewName())
- if err != nil {
- gui.c.Log.Error(err)
- return
- }
- v.TabIndex = tabIndex
+ if tabContext.Context.GetKey() == c.GetKey() {
+ // get the view, set the tab
+ v, err := gui.g.View(c.GetViewName())
+ if err != nil {
+ gui.c.Log.Error(err)
return
}
+ v.TabIndex = tabIndex
+ return
}
}
}
diff --git a/pkg/gui/context/context.go b/pkg/gui/context/context.go
index fb5a4bd64..00d472db2 100644
--- a/pkg/gui/context/context.go
+++ b/pkg/gui/context/context.go
@@ -140,44 +140,44 @@ func (self *ViewContextMap) Entries() map[string]types.Context {
}
type TabContext struct {
- Tab string
- Contexts []types.Context
+ Tab string
+ Context types.Context
}
func (tree ContextTree) InitialViewTabContextMap() map[string][]TabContext {
return map[string][]TabContext{
"branches": {
{
- Tab: "Local Branches",
- Contexts: []types.Context{tree.Branches},
+ Tab: "Local Branches",
+ Context: tree.Branches,
},
{
- Tab: "Remotes",
- Contexts: []types.Context{tree.Remotes},
+ Tab: "Remotes",
+ Context: tree.Remotes,
},
{
- Tab: "Tags",
- Contexts: []types.Context{tree.Tags},
+ Tab: "Tags",
+ Context: tree.Tags,
},
},
"commits": {
{
- Tab: "Commits",
- Contexts: []types.Context{tree.LocalCommits},
+ Tab: "Commits",
+ Context: tree.LocalCommits,
},
{
- Tab: "Reflog",
- Contexts: []types.Context{tree.ReflogCommits},
+ Tab: "Reflog",
+ Context: tree.ReflogCommits,
},
},
"files": {
{
- Tab: "Files",
- Contexts: []types.Context{tree.Files},
+ Tab: "Files",
+ Context: tree.Files,
},
{
- Tab: "Submodules",
- Contexts: []types.Context{tree.Submodules},
+ Tab: "Submodules",
+ Context: tree.Submodules,
},
},
}
diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go
index 496b99e7f..dfb77e1e2 100644
--- a/pkg/gui/view_helpers.go
+++ b/pkg/gui/view_helpers.go
@@ -94,7 +94,7 @@ func (gui *Gui) secondaryViewFocused() bool {
}
func (gui *Gui) onViewTabClick(viewName string, tabIndex int) error {
- context := gui.State.ViewTabContextMap[viewName][tabIndex].Contexts[0]
+ context := gui.State.ViewTabContextMap[viewName][tabIndex].Context
return gui.c.PushContext(context)
}