1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +02:00

Visualize the "ignore whitespace" state in the subtitle of the diff view

This commit is contained in:
Stefan Haller 2023-05-18 15:29:37 +02:00 committed by Jesse Duffield
parent 7d4bfb6621
commit 64b2685c2d
9 changed files with 38 additions and 17 deletions

View File

@ -127,6 +127,7 @@ func (self *CommitFilesController) GetOnRenderToMain() func() error {
Pair: pair,
Main: &types.ViewUpdateOpts{
Title: self.c.Tr.Patch,
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: task,
},
Secondary: secondaryPatchPanelUpdateOpts(self.c),

View File

@ -175,6 +175,7 @@ func (self *FilesController) GetOnRenderToMain() func() error {
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: self.c.Tr.DiffTitle,
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: types.NewRenderStringTask(self.c.Tr.NoChangedFiles),
},
})
@ -210,6 +211,7 @@ func (self *FilesController) GetOnRenderToMain() func() error {
Pair: pair,
Main: &types.ViewUpdateOpts{
Task: types.NewRunPtyTask(cmdObj.GetCmd()),
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Title: title,
},
}
@ -224,6 +226,7 @@ func (self *FilesController) GetOnRenderToMain() func() error {
refreshOpts.Secondary = &types.ViewUpdateOpts{
Title: title,
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: types.NewRunPtyTask(cmdObj.GetCmd()),
}
}

View File

@ -60,6 +60,7 @@ func (self *DiffHelper) RenderDiff() error {
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Diff",
SubTitle: self.IgnoringWhitespaceSubTitle(),
Task: task,
},
})
@ -112,3 +113,11 @@ func (self *DiffHelper) WithDiffModeCheck(f func() error) error {
return f()
}
func (self *DiffHelper) IgnoringWhitespaceSubTitle() string {
if self.c.State().GetIgnoreWhitespaceInDiffView() {
return self.c.Tr.IgnoreWhitespaceDiffViewSubTitle
}
return ""
}

View File

@ -177,6 +177,7 @@ func (self *LocalCommitsController) GetOnRenderToMain() func() error {
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Patch",
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: task,
},
Secondary: secondaryPatchPanelUpdateOpts(self.c),

View File

@ -75,6 +75,7 @@ func (self *StashController) GetOnRenderToMain() func() error {
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Stash",
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: task,
},
})

View File

@ -47,6 +47,7 @@ func (self *SubCommitsController) GetOnRenderToMain() func() error {
Pair: self.c.MainViewPairs().Normal,
Main: &types.ViewUpdateOpts{
Title: "Commit",
SubTitle: self.c.Helpers().Diff.IgnoringWhitespaceSubTitle(),
Task: task,
},
})

View File

@ -66,6 +66,8 @@ func (gui *Gui) RefreshMainView(opts *types.ViewUpdateOpts, context types.Contex
view.Title = opts.Title
}
view.Subtitle = opts.SubTitle
if err := gui.runTaskForView(view, opts.Task); err != nil {
gui.c.Log.Error(err)
return nil

View File

@ -22,6 +22,7 @@ type MainViewPairs struct {
type ViewUpdateOpts struct {
Title string
SubTitle string
Task UpdateTask
}

View File

@ -481,6 +481,7 @@ type TranslationSet struct {
RandomTip string
SelectParentCommitForMerge string
ToggleWhitespaceInDiffView string
IgnoreWhitespaceDiffViewSubTitle string
IgnoringWhitespaceInDiffView string
ShowingWhitespaceInDiffView string
IgnoreWhitespaceNotSupportedHere string
@ -1153,6 +1154,7 @@ func EnglishTranslationSet() TranslationSet {
RandomTip: "Random Tip",
SelectParentCommitForMerge: "Select parent commit for merge",
ToggleWhitespaceInDiffView: "Toggle whether or not whitespace changes are shown in the diff view",
IgnoreWhitespaceDiffViewSubTitle: "(ignoring whitespace)",
IgnoringWhitespaceInDiffView: "Whitespace will be ignored in the diff view",
ShowingWhitespaceInDiffView: "Whitespace will be shown in the diff view",
IgnoreWhitespaceNotSupportedHere: "Ignoring whitespace is not supported in this view",