Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/gui/context/commit_files_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type CommitFilesContext struct {
*ListContextTrait
*DynamicTitleBuilder
*SearchTrait

c *ContextCommon
}

var (
Expand Down Expand Up @@ -49,6 +51,7 @@ func NewCommitFilesContext(c *ContextCommon) *CommitFilesContext {
CommitFileTreeViewModel: viewModel,
DynamicTitleBuilder: NewDynamicTitleBuilder(c.Tr.CommitFilesDynamicTitle),
SearchTrait: NewSearchTrait(c),
c: c,
ListContextTrait: &ListContextTrait{
Context: NewSimpleContext(
NewBaseContext(NewBaseContextOpts{
Expand Down
13 changes: 13 additions & 0 deletions pkg/gui/controllers/helpers/window_arrangement_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ func sidePanelChildren(args WindowArrangementArgs) func(width int, height int) [
}
}

// In half-screen mode, when commits is focused, show both commits
// and commitFiles in a split layout
if args.ScreenMode == types.SCREEN_HALF && args.CurrentSideWindow == "commits" {
return []*boxlayout.Box{
{Window: "status", Size: 0},
{Window: "files", Size: 0},
{Window: "branches", Size: 0},
{Window: "commits", Weight: 1},
{Window: "commitFiles", Weight: 1},
{Window: "stash", Size: 0},
}
}

return []*boxlayout.Box{
fullHeightBox("status"),
fullHeightBox("files"),
Expand Down
34 changes: 34 additions & 0 deletions pkg/gui/controllers/helpers/window_arrangement_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,40 @@ func TestGetWindowDimensions(t *testing.T) {
B: information
`,
},
{
name: "half screen mode, commits focused with commitFiles split",
mutateArgs: func(args *WindowArrangementArgs) {
args.Height = 20
args.ScreenMode = types.SCREEN_HALF
args.CurrentWindow = "commits"
args.CurrentSideWindow = "commits"
args.UserConfig.Gui.EnlargedSideViewLocation = "left"
},
expected: `
╭commits─────────────────────────────╮╭main───────────────────────────────╮
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰────────────────────────────────────╯│ │
╭commitFiles─────────────────────────╮│ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
│ ││ │
╰────────────────────────────────────╯╰───────────────────────────────────╯
<stashns──────────────────────────────────────────────────────>A<B────────>
A: statusSpacer1
B: information
`,
},
{
name: "search mode",
mutateArgs: func(args *WindowArrangementArgs) {
Expand Down
3 changes: 3 additions & 0 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,9 @@ func initialWindowViewNameMap(contextTree *context.ContextTree) *utils.ThreadSaf
result.Set(context.GetWindowName(), context.GetViewName())
}

// Add direct mapping for commitFiles window used in half-screen split layout
result.Set("commitFiles", "commitFiles")

return result
}

Expand Down