diff --git a/docs/Config.md b/docs/Config.md index 03706e95b..9b48a32d8 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -117,7 +117,7 @@ gui: wrapLinesInStagingView: true # If true, hunk selection mode will be enabled by default when entering the staging view. - useHunkModeInStagingView: false + useHunkModeInStagingView: true # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru' language: auto diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 5465a376c..fc702d6da 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -739,7 +739,7 @@ func GetDefaultConfig() *UserConfig { MainPanelSplitMode: "flexible", EnlargedSideViewLocation: "left", WrapLinesInStagingView: true, - UseHunkModeInStagingView: false, + UseHunkModeInStagingView: true, Language: "auto", TimeFormat: "02 Jan 06", ShortTimeFormat: time.Kitchen, diff --git a/pkg/integration/tests/commit/stage_range_of_lines.go b/pkg/integration/tests/commit/stage_range_of_lines.go index c43706de9..5cac85d49 100644 --- a/pkg/integration/tests/commit/stage_range_of_lines.go +++ b/pkg/integration/tests/commit/stage_range_of_lines.go @@ -9,7 +9,9 @@ var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Staging a range of lines", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n") shell.Commit("Add file") diff --git a/pkg/integration/tests/demo/custom_patch.go b/pkg/integration/tests/demo/custom_patch.go index 560073d3a..24e05c633 100644 --- a/pkg/integration/tests/demo/custom_patch.go +++ b/pkg/integration/tests/demo/custom_patch.go @@ -22,6 +22,7 @@ var CustomPatch = NewIntegrationTest(NewIntegrationTestArgs{ IsDemo: true, SetupConfig: func(cfg *config.AppConfig) { setDefaultDemoConfig(cfg) + cfg.GetUserConfig().Gui.UseHunkModeInStagingView = false }, SetupRepo: func(shell *Shell) { shell.CreateNCommitsWithRandomMessages(30) diff --git a/pkg/integration/tests/patch_building/move_to_index_partial.go b/pkg/integration/tests/patch_building/move_to_index_partial.go index 409f86a57..2f2e3ea42 100644 --- a/pkg/integration/tests/patch_building/move_to_index_partial.go +++ b/pkg/integration/tests/patch_building/move_to_index_partial.go @@ -48,7 +48,6 @@ var MoveToIndexPartial = NewIntegrationTest(NewIntegrationTestArgs{ Contains(`+third line2`), ). PressPrimaryAction(). - PressPrimaryAction(). Tap(func() { t.Views().Information().Content(Contains("Building patch")) diff --git a/pkg/integration/tests/patch_building/specific_selection.go b/pkg/integration/tests/patch_building/specific_selection.go index 98cec4d1c..2e140e41c 100644 --- a/pkg/integration/tests/patch_building/specific_selection.go +++ b/pkg/integration/tests/patch_building/specific_selection.go @@ -9,7 +9,9 @@ var SpecificSelection = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Build a custom patch with a specific selection of lines, adding individual lines, as well as a range and hunk, and adding a file directly", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("hunk-file", "1a\n1b\n1c\n1d\n1e\n1f\n1g\n1h\n1i\n1j\n1k\n1l\n1m\n1n\n1o\n1p\n1q\n1r\n1s\n1t\n1u\n1v\n1w\n1x\n1y\n1z\n") shell.Commit("first commit") diff --git a/pkg/integration/tests/staging/diff_context_change.go b/pkg/integration/tests/staging/diff_context_change.go index bd4de6daa..dae511971 100644 --- a/pkg/integration/tests/staging/diff_context_change.go +++ b/pkg/integration/tests/staging/diff_context_change.go @@ -50,7 +50,6 @@ var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Staging(). IsFocused(). - Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`-3a`), Contains(`+3b`), @@ -92,7 +91,6 @@ var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().StagingSecondary(). IsFocused(). - Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`-3a`), Contains(`+3b`), diff --git a/pkg/integration/tests/staging/discard_all_changes.go b/pkg/integration/tests/staging/discard_all_changes.go index e73f69a5e..89725da78 100644 --- a/pkg/integration/tests/staging/discard_all_changes.go +++ b/pkg/integration/tests/staging/discard_all_changes.go @@ -31,6 +31,7 @@ var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{ t.Views().Staging(). IsFocused(). + Press(keys.Main.ToggleSelectHunk). SelectedLines(Contains("+three")). // discard the line Press(keys.Universal.Remove). diff --git a/pkg/integration/tests/staging/stage_hunks.go b/pkg/integration/tests/staging/stage_hunks.go index 8acd39388..7afc3a24d 100644 --- a/pkg/integration/tests/staging/stage_hunks.go +++ b/pkg/integration/tests/staging/stage_hunks.go @@ -9,7 +9,9 @@ var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various hunks of a file in the staging panel", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a") shell.Commit("one") diff --git a/pkg/integration/tests/staging/stage_lines.go b/pkg/integration/tests/staging/stage_lines.go index 5df7b23d4..39ea2d0bf 100644 --- a/pkg/integration/tests/staging/stage_lines.go +++ b/pkg/integration/tests/staging/stage_lines.go @@ -9,7 +9,9 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various lines of a file in the staging panel", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.Commit("one") diff --git a/pkg/integration/tests/staging/stage_ranges.go b/pkg/integration/tests/staging/stage_ranges.go index cd2157e0c..3d96d0610 100644 --- a/pkg/integration/tests/staging/stage_ranges.go +++ b/pkg/integration/tests/staging/stage_ranges.go @@ -9,7 +9,9 @@ var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various ranges of a file in the staging panel", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.Commit("one") diff --git a/pkg/integration/tests/stash/stash_staged_partial_file.go b/pkg/integration/tests/stash/stash_staged_partial_file.go index 5337eaee2..f77c6e16c 100644 --- a/pkg/integration/tests/stash/stash_staged_partial_file.go +++ b/pkg/integration/tests/stash/stash_staged_partial_file.go @@ -26,7 +26,6 @@ var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{ Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"), ). PressPrimaryAction(). - PressPrimaryAction(). Content( Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"), ). diff --git a/pkg/integration/tests/ui/range_select.go b/pkg/integration/tests/ui/range_select.go index f9487632a..b021ea65d 100644 --- a/pkg/integration/tests/ui/range_select.go +++ b/pkg/integration/tests/ui/range_select.go @@ -31,7 +31,9 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Verify range select works as expected in list views and in patch explorer views", ExtraCmdArgs: []string{}, Skip: false, - SetupConfig: func(config *config.AppConfig) {}, + SetupConfig: func(config *config.AppConfig) { + config.GetUserConfig().Gui.UseHunkModeInStagingView = false + }, SetupRepo: func(shell *Shell) { // We're testing the commits view as our representative list context, // as well as the staging view, and we're using the exact same code to test diff --git a/schema/config.json b/schema/config.json index 9f73e8974..d2d00e4b8 100644 --- a/schema/config.json +++ b/schema/config.json @@ -569,7 +569,7 @@ "useHunkModeInStagingView": { "type": "boolean", "description": "If true, hunk selection mode will be enabled by default when entering the staging view.", - "default": false + "default": true }, "language": { "type": "string",