Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/commands/git_commands/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (self *CommitCommands) ShowCmdObj(hash string, filterPath string) *oscomman
Arg(hash).
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
Arg(fmt.Sprintf("--find-renames=%d%%", self.AppState.RenameSimilarityThreshold)).
ArgIf(filterPath != "", "--", filterPath).
ArgIf(filterPath != "" && !self.AppState.ShowFullDiffInFilterByPathMode, "--", filterPath).
Dir(self.repoPaths.worktreePath).
ToArgv()

Expand Down
2 changes: 2 additions & 0 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ type AppState struct {
// This determines whether the git graph is rendered in the commits panel
// One of 'always' | 'never' | 'when-maximised'
GitLogShowGraph string

ShowFullDiffInFilterByPathMode bool
}

func getDefaultAppState() *AppState {
Expand Down
16 changes: 16 additions & 0 deletions pkg/gui/controllers/filtering_menu_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (self *FilteringMenuAction) Call() error {

menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.FilterPathOption,
Key: 'p',
OnPress: func() error {
self.c.Prompt(types.PromptOpts{
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetFilePathSuggestionsFunc(),
Expand All @@ -76,6 +77,7 @@ func (self *FilteringMenuAction) Call() error {

menuItems = append(menuItems, &types.MenuItem{
Label: self.c.Tr.FilterAuthorOption,
Key: 'a',
OnPress: func() error {
self.c.Prompt(types.PromptOpts{
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetAuthorsSuggestionsFunc(),
Expand All @@ -90,9 +92,23 @@ 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,
Key: 's',
OnPress: self.c.Helpers().Mode.ClearFiltering,
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gui/controllers/helpers/diff_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down