summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-07-17 16:29:55 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-07-30 18:35:23 +1000
commit0604e43813f9befc9738572deaeaba06fcf2a2e3 (patch)
treee6723a45b4ed2ab6b7d4afeb2998301e2b2be241
parent27ade502ee8689888f88063d460705a5d2c66777 (diff)
Move worktrees tab to files window
-rw-r--r--pkg/gui/context/worktrees_context.go2
-rw-r--r--pkg/gui/gui.go52
2 files changed, 28 insertions, 26 deletions
diff --git a/pkg/gui/context/worktrees_context.go b/pkg/gui/context/worktrees_context.go
index aa1dcd4a1..7f15d67b1 100644
--- a/pkg/gui/context/worktrees_context.go
+++ b/pkg/gui/context/worktrees_context.go
@@ -34,7 +34,7 @@ func NewWorktreesContext(c *ContextCommon) *WorktreesContext {
ListContextTrait: &ListContextTrait{
Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
View: c.Views().Worktrees,
- WindowName: "branches",
+ WindowName: "files",
Key: WORKTREES_CONTEXT_KEY,
Kind: types.SIDE_CONTEXT,
Focusable: true,
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 1b58c7a9a..838d70792 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -566,32 +566,21 @@ func (gui *Gui) initGocui(headless bool, test integrationTypes.IntegrationTest)
}
func (gui *Gui) viewTabMap() map[string][]context.TabView {
- branchesTabs := []context.TabView{
- {
- Tab: gui.c.Tr.LocalBranchesTitle,
- ViewName: "localBranches",
- },
- {
- Tab: gui.c.Tr.RemotesTitle,
- ViewName: "remotes",
- },
- {
- Tab: gui.c.Tr.TagsTitle,
- ViewName: "tags",
- },
- }
-
- if gui.c.Git().Version.SupportsWorktrees() {
- branchesTabs = append(branchesTabs,
- context.TabView{
- Tab: gui.c.Tr.WorktreesTitle,
- ViewName: "worktrees",
+ result := map[string][]context.TabView{
+ "branches": {
+ {
+ Tab: gui.c.Tr.LocalBranchesTitle,
+ ViewName: "localBranches",
},
- )
- }
-
- return map[string][]context.TabView{
- "branches": branchesTabs,
+ {
+ Tab: gui.c.Tr.RemotesTitle,
+ ViewName: "remotes",
+ },
+ {
+ Tab: gui.c.Tr.TagsTitle,
+ ViewName: "tags",
+ },
+ },
"commits": {
{
Tab: gui.c.Tr.CommitsTitle,
@@ -613,6 +602,19 @@ func (gui *Gui) viewTabMap() map[string][]context.TabView {
},
},
}
+
+ if gui.c.Git().Version.SupportsWorktrees() {
+ // insert between files and submodules tabs
+ result["files"] = append(result["files"][0:1],
+ context.TabView{
+ Tab: gui.c.Tr.WorktreesTitle,
+ ViewName: "worktrees",
+ },
+ result["files"][1],
+ )
+ }
+
+ return result
}
// Run: setup the gui with keybindings and start the mainloop