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

Enable hunk staging mode by default

This commit is contained in:
Stefan Haller
2025-07-28 18:05:17 +02:00
parent eb41bd2af2
commit 4d51234ee2
14 changed files with 23 additions and 13 deletions

View File

@ -117,7 +117,7 @@ gui:
wrapLinesInStagingView: true wrapLinesInStagingView: true
# If true, hunk selection mode will be enabled by default when entering the staging view. # 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' # One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
language: auto language: auto

View File

@ -739,7 +739,7 @@ func GetDefaultConfig() *UserConfig {
MainPanelSplitMode: "flexible", MainPanelSplitMode: "flexible",
EnlargedSideViewLocation: "left", EnlargedSideViewLocation: "left",
WrapLinesInStagingView: true, WrapLinesInStagingView: true,
UseHunkModeInStagingView: false, UseHunkModeInStagingView: true,
Language: "auto", Language: "auto",
TimeFormat: "02 Jan 06", TimeFormat: "02 Jan 06",
ShortTimeFormat: time.Kitchen, ShortTimeFormat: time.Kitchen,

View File

@ -9,7 +9,9 @@ var StageRangeOfLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Staging a range of lines", Description: "Staging a range of lines",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n") shell.CreateFileAndAdd("myfile", "1st\n2nd\n3rd\n4th\n5th\n6th\n")
shell.Commit("Add file") shell.Commit("Add file")

View File

@ -22,6 +22,7 @@ var CustomPatch = NewIntegrationTest(NewIntegrationTestArgs{
IsDemo: true, IsDemo: true,
SetupConfig: func(cfg *config.AppConfig) { SetupConfig: func(cfg *config.AppConfig) {
setDefaultDemoConfig(cfg) setDefaultDemoConfig(cfg)
cfg.GetUserConfig().Gui.UseHunkModeInStagingView = false
}, },
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateNCommitsWithRandomMessages(30) shell.CreateNCommitsWithRandomMessages(30)

View File

@ -48,7 +48,6 @@ var MoveToIndexPartial = NewIntegrationTest(NewIntegrationTestArgs{
Contains(`+third line2`), Contains(`+third line2`),
). ).
PressPrimaryAction(). PressPrimaryAction().
PressPrimaryAction().
Tap(func() { Tap(func() {
t.Views().Information().Content(Contains("Building patch")) t.Views().Information().Content(Contains("Building patch"))

View File

@ -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", 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{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { 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.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") shell.Commit("first commit")

View File

@ -50,7 +50,6 @@ var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Staging(). t.Views().Staging().
IsFocused(). IsFocused().
Press(keys.Main.ToggleSelectHunk).
SelectedLines( SelectedLines(
Contains(`-3a`), Contains(`-3a`),
Contains(`+3b`), Contains(`+3b`),
@ -92,7 +91,6 @@ var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().StagingSecondary(). t.Views().StagingSecondary().
IsFocused(). IsFocused().
Press(keys.Main.ToggleSelectHunk).
SelectedLines( SelectedLines(
Contains(`-3a`), Contains(`-3a`),
Contains(`+3b`), Contains(`+3b`),

View File

@ -31,6 +31,7 @@ var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Staging(). t.Views().Staging().
IsFocused(). IsFocused().
Press(keys.Main.ToggleSelectHunk).
SelectedLines(Contains("+three")). SelectedLines(Contains("+three")).
// discard the line // discard the line
Press(keys.Universal.Remove). Press(keys.Universal.Remove).

View File

@ -9,7 +9,9 @@ var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various hunks of a file in the staging panel", Description: "Stage and unstage various hunks of a file in the staging panel",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a") shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a")
shell.Commit("one") shell.Commit("one")

View File

@ -9,7 +9,9 @@ var StageLines = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various lines of a file in the staging panel", Description: "Stage and unstage various lines of a file in the staging panel",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.CreateFileAndAdd("file1", "one\ntwo\n")
shell.Commit("one") shell.Commit("one")

View File

@ -9,7 +9,9 @@ var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Stage and unstage various ranges of a file in the staging panel", Description: "Stage and unstage various ranges of a file in the staging panel",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.CreateFileAndAdd("file1", "one\ntwo\n")
shell.Commit("one") shell.Commit("one")

View File

@ -26,7 +26,6 @@ var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{
Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"), Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"),
). ).
PressPrimaryAction(). PressPrimaryAction().
PressPrimaryAction().
Content( Content(
Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"), Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"),
). ).

View File

@ -31,7 +31,9 @@ var RangeSelect = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Verify range select works as expected in list views and in patch explorer views", Description: "Verify range select works as expected in list views and in patch explorer views",
ExtraCmdArgs: []string{}, ExtraCmdArgs: []string{},
Skip: false, Skip: false,
SetupConfig: func(config *config.AppConfig) {}, SetupConfig: func(config *config.AppConfig) {
config.GetUserConfig().Gui.UseHunkModeInStagingView = false
},
SetupRepo: func(shell *Shell) { SetupRepo: func(shell *Shell) {
// We're testing the commits view as our representative list context, // 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 // as well as the staging view, and we're using the exact same code to test

View File

@ -569,7 +569,7 @@
"useHunkModeInStagingView": { "useHunkModeInStagingView": {
"type": "boolean", "type": "boolean",
"description": "If true, hunk selection mode will be enabled by default when entering the staging view.", "description": "If true, hunk selection mode will be enabled by default when entering the staging view.",
"default": false "default": true
}, },
"language": { "language": {
"type": "string", "type": "string",