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

Show hint about hunk staging mode being the default now, and how to switch to line mode

It is shown the first time the user enters either staging or patch building.
This commit is contained in:
Stefan Haller
2025-07-28 18:03:27 +02:00
parent 37724e9d14
commit 3d703bc9b9
6 changed files with 38 additions and 4 deletions

View File

@ -494,6 +494,8 @@ func (self *CommitFilesController) enterCommitFile(node *filetree.CommitFileNode
}
self.c.Context().Push(self.c.Contexts().CustomPatchBuilder, opts)
self.c.Helpers().PatchBuilding.ShowHunkStagingHint()
return nil
},
})

View File

@ -554,6 +554,8 @@ func (self *FilesController) EnterFile(opts types.OnFocusOpts) error {
context := lo.Ternary(opts.ClickedWindowName == "secondary", self.c.Contexts().StagingSecondary, self.c.Contexts().Staging)
self.c.Context().Push(context, opts)
self.c.Helpers().PatchBuilding.ShowHunkStagingHint()
return nil
}

View File

@ -2,8 +2,10 @@ package helpers
import (
"errors"
"fmt"
"github.com/jesseduffield/lazygit/pkg/commands/patch"
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
"github.com/jesseduffield/lazygit/pkg/gui/patch_exploring"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
@ -27,6 +29,19 @@ func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)
return true, nil
}
func (self *PatchBuildingHelper) ShowHunkStagingHint() {
if !self.c.AppState.DidShowHunkStagingHint && self.c.UserConfig().Gui.UseHunkModeInStagingView {
self.c.AppState.DidShowHunkStagingHint = true
self.c.SaveAppStateAndLogError()
message := fmt.Sprintf(self.c.Tr.HunkStagingHint,
keybindings.Label(self.c.UserConfig().Keybinding.Main.ToggleSelectHunk))
self.c.Confirm(types.ConfirmOpts{
Prompt: message,
})
}
}
// takes us from the patch building panel back to the commit files panel
func (self *PatchBuildingHelper) Escape() {
self.c.Context().Pop()