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: 2 additions & 1 deletion pkg/gui/controllers/helpers/window_arrangement_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ func getMidSectionWeights(args WindowArrangementArgs) (int, int) {
}

if args.CurrentWindow == "main" || args.CurrentWindow == "secondary" {
if args.ScreenMode == types.SCREEN_HALF || args.ScreenMode == types.SCREEN_FULL {
if args.ScreenMode == types.SCREEN_HALF || args.ScreenMode == types.SCREEN_FULL || mainSectionWeight == 0 {
sideSectionWeight = 0
mainSectionWeight = 1
}
} else {
if args.ScreenMode == types.SCREEN_HALF {
Expand Down
81 changes: 81 additions & 0 deletions pkg/gui/controllers/helpers/window_arrangement_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,87 @@ func TestGetWindowDimensions(t *testing.T) {
B: information
`,
},
{
name: "1.0 SidePanelWidth",
mutateArgs: func(args *WindowArrangementArgs) {
args.UserConfig.Gui.SidePanelWidth = 1.0
},
expected: `
╭status───────────────────────────────────────────────────────────────────╮
│ │
╰─────────────────────────────────────────────────────────────────────────╯
╭files────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
╭branches─────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
╭commits──────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
╭stash────────────────────────────────────────────────────────────────────╮
│ │
╰─────────────────────────────────────────────────────────────────────────╯
<options──────────────────────────────────────────────────────>A<B────────>
A: statusSpacer1
B: information
`,
},
{
name: "1.0 SidePanelWidth main view focused",
mutateArgs: func(args *WindowArrangementArgs) {
args.UserConfig.Gui.SidePanelWidth = 1.0
args.CurrentWindow = "main"
},
expected: `
╭main─────────────────────────────────────────────────────────────────────╮
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
<options──────────────────────────────────────────────────────>A<B────────>
A: statusSpacer1
B: information
`,
},
{
name: "half screen mode, enlargedSideViewLocation left",
mutateArgs: func(args *WindowArrangementArgs) {
Expand Down
1 change: 1 addition & 0 deletions pkg/integration/tests/test_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ var tests = []*components.IntegrationTest{
ui.ModeSpecificKeybindingSuggestions,
ui.OpenLinkFailure,
ui.RangeSelect,
ui.SidePanelWidth1,
ui.SwitchTabFromMenu,
ui.SwitchTabWithPanelJumpKeys,
undo.UndoCheckoutAndDrop,
Expand Down
29 changes: 29 additions & 0 deletions pkg/integration/tests/ui/side_panel_width_1.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ui

import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)

var SidePanelWidth1 = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify that setting sidePanelWidth to 1.0 doesn't crash when navigating to commit files",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.SidePanelWidth = 1.0
},
SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1.txt", "content")
shell.Commit("first commit")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Commits().Focus().
Press(keys.Universal.NextScreenMode).
Press(keys.Universal.GoInto)

t.Views().CommitFiles().
Press(keys.Universal.GoInto)

t.Views().PatchBuilding().Content(Contains("+content"))
},
})
Loading