1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/whitespace-toggle.go

22 lines
595 B
Go
Raw Normal View History

package gui
func (gui *Gui) toggleWhitespaceInDiffView() error {
return gui.setIgnoreWhitespaceFlag(!gui.State.IgnoreWhitespaceInDiffView)
}
func (gui *Gui) setIgnoreWhitespaceFlag(shouldIgnoreWhitespace bool) error {
if gui.State.IgnoreWhitespaceInDiffView == shouldIgnoreWhitespace {
return nil
}
gui.State.IgnoreWhitespaceInDiffView = shouldIgnoreWhitespace
toastMessage := gui.Tr.ShowingWhitespaceInDiffView
if gui.State.IgnoreWhitespaceInDiffView {
toastMessage = gui.Tr.IgnoringWhitespaceInDiffView
}
gui.raiseToast(toastMessage)
return gui.refreshFilesAndSubmodules()
}