mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
move toggle whitespace action to controllers package
This commit is contained in:
21
pkg/gui/controllers/toggle_whitespace_action.go
Normal file
21
pkg/gui/controllers/toggle_whitespace_action.go
Normal file
@ -0,0 +1,21 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
type ToggleWhitespaceAction struct {
|
||||
c *ControllerCommon
|
||||
}
|
||||
|
||||
func (self *ToggleWhitespaceAction) Call() error {
|
||||
self.c.State().SetIgnoreWhitespaceInDiffView(!self.c.State().GetIgnoreWhitespaceInDiffView())
|
||||
|
||||
toastMessage := self.c.Tr.ShowingWhitespaceInDiffView
|
||||
if self.c.State().GetIgnoreWhitespaceInDiffView() {
|
||||
toastMessage = self.c.Tr.IgnoringWhitespaceInDiffView
|
||||
}
|
||||
self.c.Toast(toastMessage)
|
||||
|
||||
return self.c.CurrentSideContext().HandleFocus(types.OnFocusOpts{})
|
||||
}
|
Reference in New Issue
Block a user