1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-24 08:52:21 +02:00

implement feedback when toggling whitespace

This commit is contained in:
Davyd McColl 2021-06-07 10:08:38 +02:00 committed by Jesse Duffield
parent eb10ddfccc
commit 16dcc8f4db
3 changed files with 13 additions and 0 deletions

View File

@ -166,6 +166,8 @@ type KeybindingUniversalConfig struct {
AppendNewline string `yaml:"appendNewline"`
ExtrasMenu string `yaml:"extrasMenu"`
ToggleWhitespaceInDiffView string `yaml:"toggleWhitespaceInDiffView"`
IgnoringWhitespaceInDiffView string `yaml:"ignoringWhitespaceInDiffView"`
ShowingWhitespaceInDiffView string `yaml:"showingWhitespaceInDiffView"`
}
type KeybindingStatusConfig struct {

View File

@ -31,6 +31,13 @@ func (gui *Gui) handleQuitWithoutChangingDirectory() error {
func (gui *Gui) toggleWhitespaceInDiffView() error {
gui.State.IgnoreWhitespaceInDiffView = !gui.State.IgnoreWhitespaceInDiffView
var toastMessage string
if gui.State.IgnoreWhitespaceInDiffView {
toastMessage = gui.Tr.IgnoringWhitespaceInDiffView
} else {
toastMessage = gui.Tr.ShowingWhitespaceInDiffView
}
gui.raiseToast(toastMessage)
return gui.refreshFilesAndSubmodules()
}

View File

@ -452,6 +452,8 @@ type TranslationSet struct {
RandomTip string
SelectParentCommitForMerge string
ToggleWhitespaceInDiffView string
IgnoringWhitespaceInDiffView string
ShowingWhitespaceInDiffView string
Spans Spans
}
@ -997,6 +999,8 @@ 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",
IgnoringWhitespaceInDiffView: "Whitespace will be ignored in the diff view",
ShowingWhitespaceInDiffView: "Whitespace will be shown in the diff view",
Spans: Spans{
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
CheckoutCommit: "Checkout commit",