/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/gui/controllers/toggle_whitespace_action.go
32 строки
965 B
Stefan Haller
Move IgnoreWhitespaceInDiffView to user config
09 июл 2025, 14:15
09 июл 2025, 14:15
8d7bfd1
Код
Авторство
О чём код?
package controllers import ( "errors" "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" "github.com/samber/lo" ) type ToggleWhitespaceAction struct { c *ControllerCommon } func (self *ToggleWhitespaceAction) Call() error { contextsThatDontSupportIgnoringWhitespace := []types.ContextKey{ context.STAGING_MAIN_CONTEXT_KEY, context.STAGING_SECONDARY_CONTEXT_KEY, context.PATCH_BUILDING_MAIN_CONTEXT_KEY, } if lo.Contains(contextsThatDontSupportIgnoringWhitespace, self.c.Context().Current().GetKey()) { // Ignoring whitespace is not supported in these views. Let the user // know that it's not going to work in case they try to turn it on. return errors.New(self.c.Tr.IgnoreWhitespaceNotSupportedHere) } self.c.UserConfig().Git.IgnoreWhitespaceInDiffView = !self.c.UserConfig().Git.IgnoreWhitespaceInDiffView self.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{}) return nil }