1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

Add a "Show full diff" checkbox to the filtering menu

It is only visible when filtering by path.
This commit is contained in:
Stefan Haller
2025-05-25 15:18:53 +02:00
parent b5d97570f1
commit 781eb61ed2
4 changed files with 17 additions and 2 deletions

View File

@ -92,6 +92,19 @@ func (self *FilteringMenuAction) Call() error {
Tooltip: tooltip,
})
if path := self.c.Modes().Filtering.GetPath(); path != "" {
menuItems = append(menuItems, &types.MenuItem{
Label: "Show full diff", // TODO: i18n (and tooltip?)
Key: 'f',
OnPress: func() error {
self.c.AppState.ShowFullDiffInFilterByPathMode = !self.c.AppState.ShowFullDiffInFilterByPathMode
self.c.SaveAppStateAndLogError()
return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.COMMITS}})
},
Widget: types.MakeMenuCheckBox(self.c.AppState.ShowFullDiffInFilterByPathMode),
})
}
if self.c.Modes().Filtering.Active() {
menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.ExitFilterMode,

View File

@ -57,7 +57,7 @@ func (self *DiffHelper) GetUpdateTaskForRenderingCommitsDiff(commit *models.Comm
from, to := refRange.From, refRange.To
args := []string{from.ParentRefName(), to.RefName(), "--stat", "-p"}
args = append(args, "--")
if path := self.c.Modes().Filtering.GetPath(); path != "" {
if path := self.c.Modes().Filtering.GetPath(); path != "" && !self.c.AppState.ShowFullDiffInFilterByPathMode {
args = append(args, path)
}
cmdObj := self.c.Git().Diff.DiffCmdObj(args)