summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAzraelSec <me@azraelsec.sh>2024-06-05 02:52:11 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-06-07 22:51:16 +0200
commit06496ccd17d0e6f88c3b4eceba814c6269e9c571 (patch)
tree7ffaf7bac1c2970b7f43d4adb2ea1ecc13f997ce /pkg
parent03a075c223d149d6d1fc50d88e15f42b52fad4fb (diff)
feat: let the staging secondary panel change view mode
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/controllers/helpers/window_arrangement_helper.go11
-rw-r--r--pkg/integration/tests/staging/diff_change_screen_mode.go47
-rw-r--r--pkg/integration/tests/test_list.go1
3 files changed, 58 insertions, 1 deletions
diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper.go b/pkg/gui/controllers/helpers/window_arrangement_helper.go
index 5c17083f7..0eb7cdb4a 100644
--- a/pkg/gui/controllers/helpers/window_arrangement_helper.go
+++ b/pkg/gui/controllers/helpers/window_arrangement_helper.go
@@ -216,6 +216,15 @@ func mainSectionChildren(args WindowArrangementArgs) []*boxlayout.Box {
}
}
+ if args.CurrentWindow == "secondary" && args.ScreenMode == types.SCREEN_FULL {
+ return []*boxlayout.Box{
+ {
+ Window: "secondary",
+ Weight: 1,
+ },
+ }
+ }
+
return []*boxlayout.Box{
{
Window: "main",
@@ -239,7 +248,7 @@ func getMidSectionWeights(args WindowArrangementArgs) (int, int) {
mainSectionWeight = 5 // need to shrink side panel to make way for main panels if side-by-side
}
- if args.CurrentWindow == "main" {
+ if args.CurrentWindow == "main" || args.CurrentWindow == "secondary" {
if args.ScreenMode == types.SCREEN_HALF || args.ScreenMode == types.SCREEN_FULL {
sideSectionWeight = 0
}
diff --git a/pkg/integration/tests/staging/diff_change_screen_mode.go b/pkg/integration/tests/staging/diff_change_screen_mode.go
new file mode 100644
index 000000000..b42439cc8
--- /dev/null
+++ b/pkg/integration/tests/staging/diff_change_screen_mode.go
@@ -0,0 +1,47 @@
+package staging
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var DiffChangeScreenMode = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Change the staged changes screen mode",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {},
+ SetupRepo: func(shell *Shell) {
+ shell.CreateFile("file", "first line\nsecond line")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Files().
+ Focus().
+ PressEnter()
+
+ t.Views().Staging().
+ IsFocused().
+ PressPrimaryAction().
+ Title(Equals("Unstaged changes")).
+ Content(Contains("+second line").DoesNotContain("+first line")).
+ PressTab()
+
+ t.Views().StagingSecondary().
+ IsFocused().
+ Title(Equals("Staged changes")).
+ Content(Contains("+first line").DoesNotContain("+second line")).
+ Press(keys.Universal.NextScreenMode).
+ Tap(func() {
+ t.Views().AppStatus().
+ IsInvisible()
+ t.Views().Staging().
+ IsVisible()
+ }).
+ Press(keys.Universal.NextScreenMode).
+ Tap(func() {
+ t.Views().AppStatus().
+ IsInvisible()
+ t.Views().Staging().
+ IsInvisible()
+ })
+ },
+})
diff --git a/pkg/integration/tests/test_list.go b/pkg/integration/tests/test_list.go
index c1e153a2b..d4ebd4026 100644
--- a/pkg/integration/tests/test_list.go
+++ b/pkg/integration/tests/test_list.go
@@ -245,6 +245,7 @@ var tests = []*components.IntegrationTest{
reflog.DoNotShowBranchMarkersInReflogSubcommits,
reflog.Patch,
reflog.Reset,
+ staging.DiffChangeScreenMode,
staging.DiffContextChange,
staging.DiscardAllChanges,
staging.Search,