mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +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:
parent
b5d97570f1
commit
781eb61ed2
@ -271,7 +271,7 @@ func (self *CommitCommands) ShowCmdObj(hash string, filterPath string) *oscomman
|
|||||||
Arg(hash).
|
Arg(hash).
|
||||||
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
|
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
|
||||||
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
|
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
|
||||||
ArgIf(filterPath != "", "--", filterPath).
|
ArgIf(filterPath != "" && !self.AppState.ShowFullDiffInFilterByPathMode, "--", filterPath).
|
||||||
Dir(self.repoPaths.worktreePath).
|
Dir(self.repoPaths.worktreePath).
|
||||||
ToArgv()
|
ToArgv()
|
||||||
|
|
||||||
|
@ -691,6 +691,8 @@ type AppState struct {
|
|||||||
// This determines whether the git graph is rendered in the commits panel
|
// This determines whether the git graph is rendered in the commits panel
|
||||||
// One of 'always' | 'never' | 'when-maximised'
|
// One of 'always' | 'never' | 'when-maximised'
|
||||||
GitLogShowGraph string
|
GitLogShowGraph string
|
||||||
|
|
||||||
|
ShowFullDiffInFilterByPathMode bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDefaultAppState() *AppState {
|
func getDefaultAppState() *AppState {
|
||||||
|
@ -92,6 +92,19 @@ func (self *FilteringMenuAction) Call() error {
|
|||||||
Tooltip: tooltip,
|
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() {
|
if self.c.Modes().Filtering.Active() {
|
||||||
menuItems = append(menuItems, &types.MenuItem{
|
menuItems = append(menuItems, &types.MenuItem{
|
||||||
Label: self.c.Tr.ExitFilterMode,
|
Label: self.c.Tr.ExitFilterMode,
|
||||||
|
@ -57,7 +57,7 @@ func (self *DiffHelper) GetUpdateTaskForRenderingCommitsDiff(commit *models.Comm
|
|||||||
from, to := refRange.From, refRange.To
|
from, to := refRange.From, refRange.To
|
||||||
args := []string{from.ParentRefName(), to.RefName(), "--stat", "-p"}
|
args := []string{from.ParentRefName(), to.RefName(), "--stat", "-p"}
|
||||||
args = append(args, "--")
|
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)
|
args = append(args, path)
|
||||||
}
|
}
|
||||||
cmdObj := self.c.Git().Diff.DiffCmdObj(args)
|
cmdObj := self.c.Git().Diff.DiffCmdObj(args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user