1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-07 22:02:56 +03:00

Move worktrees tab to files window

This commit is contained in:
Jesse Duffield
2023-07-17 16:29:55 +10:00
parent 27ade502ee
commit 0604e43813
2 changed files with 28 additions and 26 deletions

View File

@@ -34,7 +34,7 @@ func NewWorktreesContext(c *ContextCommon) *WorktreesContext {
ListContextTrait: &ListContextTrait{ ListContextTrait: &ListContextTrait{
Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{ Context: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
View: c.Views().Worktrees, View: c.Views().Worktrees,
WindowName: "branches", WindowName: "files",
Key: WORKTREES_CONTEXT_KEY, Key: WORKTREES_CONTEXT_KEY,
Kind: types.SIDE_CONTEXT, Kind: types.SIDE_CONTEXT,
Focusable: true, Focusable: true,

View File

@@ -566,32 +566,21 @@ func (gui *Gui) initGocui(headless bool, test integrationTypes.IntegrationTest)
} }
func (gui *Gui) viewTabMap() map[string][]context.TabView { func (gui *Gui) viewTabMap() map[string][]context.TabView {
branchesTabs := []context.TabView{ result := map[string][]context.TabView{
{ "branches": {
Tab: gui.c.Tr.LocalBranchesTitle, {
ViewName: "localBranches", 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",
}, },
) {
} Tab: gui.c.Tr.RemotesTitle,
ViewName: "remotes",
return map[string][]context.TabView{ },
"branches": branchesTabs, {
Tab: gui.c.Tr.TagsTitle,
ViewName: "tags",
},
},
"commits": { "commits": {
{ {
Tab: gui.c.Tr.CommitsTitle, 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 // Run: setup the gui with keybindings and start the mainloop