diff --git a/pkg/gui/controllers/context_lines_controller.go b/pkg/gui/controllers/context_lines_controller.go index 5e0f9d606..b2484f6d0 100644 --- a/pkg/gui/controllers/context_lines_controller.go +++ b/pkg/gui/controllers/context_lines_controller.go @@ -7,25 +7,10 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/samber/lo" ) // This controller lets you change the context size for diffs. The 'context' in 'context size' refers to the conventional meaning of the word 'context' in a diff, as opposed to lazygit's own idea of a 'context'. -var CONTEXT_KEYS_SHOWING_DIFFS = []types.ContextKey{ - context.FILES_CONTEXT_KEY, - context.COMMIT_FILES_CONTEXT_KEY, - context.STASH_CONTEXT_KEY, - context.LOCAL_COMMITS_CONTEXT_KEY, - context.SUB_COMMITS_CONTEXT_KEY, - context.STAGING_MAIN_CONTEXT_KEY, - context.STAGING_SECONDARY_CONTEXT_KEY, - context.PATCH_BUILDING_MAIN_CONTEXT_KEY, - context.PATCH_BUILDING_SECONDARY_CONTEXT_KEY, - context.NORMAL_MAIN_CONTEXT_KEY, - context.NORMAL_SECONDARY_CONTEXT_KEY, -} - type ContextLinesController struct { baseController c *ControllerCommon @@ -66,33 +51,25 @@ func (self *ContextLinesController) Context() types.Context { } func (self *ContextLinesController) Increase() error { - if self.isShowingDiff() { - if err := self.checkCanChangeContext(); err != nil { - return err - } - - if self.c.UserConfig().Git.DiffContextSize < math.MaxUint64 { - self.c.UserConfig().Git.DiffContextSize++ - } - return self.applyChange() + if err := self.checkCanChangeContext(); err != nil { + return err } - return nil + if self.c.UserConfig().Git.DiffContextSize < math.MaxUint64 { + self.c.UserConfig().Git.DiffContextSize++ + } + return self.applyChange() } func (self *ContextLinesController) Decrease() error { - if self.isShowingDiff() { - if err := self.checkCanChangeContext(); err != nil { - return err - } - - if self.c.UserConfig().Git.DiffContextSize > 0 { - self.c.UserConfig().Git.DiffContextSize-- - } - return self.applyChange() + if err := self.checkCanChangeContext(); err != nil { + return err } - return nil + if self.c.UserConfig().Git.DiffContextSize > 0 { + self.c.UserConfig().Git.DiffContextSize-- + } + return self.applyChange() } func (self *ContextLinesController) applyChange() error { @@ -119,13 +96,6 @@ func (self *ContextLinesController) checkCanChangeContext() error { return nil } -func (self *ContextLinesController) isShowingDiff() bool { - return lo.Contains( - CONTEXT_KEYS_SHOWING_DIFFS, - self.currentSidePanel().GetKey(), - ) -} - func (self *ContextLinesController) currentSidePanel() types.Context { currentContext := self.c.Context().CurrentStatic() if currentContext.GetKey() == context.NORMAL_MAIN_CONTEXT_KEY || diff --git a/pkg/gui/controllers/rename_similarity_threshold_controller.go b/pkg/gui/controllers/rename_similarity_threshold_controller.go index 98df26127..522785a04 100644 --- a/pkg/gui/controllers/rename_similarity_threshold_controller.go +++ b/pkg/gui/controllers/rename_similarity_threshold_controller.go @@ -5,20 +5,10 @@ import ( "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" - "github.com/samber/lo" ) // This controller lets you change the similarity threshold for detecting renames. -var CONTEXT_KEYS_SHOWING_RENAMES = []types.ContextKey{ - context.FILES_CONTEXT_KEY, - context.SUB_COMMITS_CONTEXT_KEY, - context.LOCAL_COMMITS_CONTEXT_KEY, - context.STASH_CONTEXT_KEY, - context.NORMAL_MAIN_CONTEXT_KEY, - context.NORMAL_SECONDARY_CONTEXT_KEY, -} - type RenameSimilarityThresholdController struct { baseController c *ControllerCommon @@ -61,23 +51,21 @@ func (self *RenameSimilarityThresholdController) Context() types.Context { func (self *RenameSimilarityThresholdController) Increase() error { old_size := self.c.UserConfig().Git.RenameSimilarityThreshold - if self.isShowingRenames() && old_size < 100 { + if old_size < 100 { self.c.UserConfig().Git.RenameSimilarityThreshold = min(100, old_size+5) - return self.applyChange() } - return nil + return self.applyChange() } func (self *RenameSimilarityThresholdController) Decrease() error { old_size := self.c.UserConfig().Git.RenameSimilarityThreshold - if self.isShowingRenames() && old_size > 5 { + if old_size > 5 { self.c.UserConfig().Git.RenameSimilarityThreshold = max(5, old_size-5) - return self.applyChange() } - return nil + return self.applyChange() } func (self *RenameSimilarityThresholdController) applyChange() error { @@ -94,13 +82,6 @@ func (self *RenameSimilarityThresholdController) applyChange() error { return nil } -func (self *RenameSimilarityThresholdController) isShowingRenames() bool { - return lo.Contains( - CONTEXT_KEYS_SHOWING_RENAMES, - self.currentSidePanel().GetKey(), - ) -} - func (self *RenameSimilarityThresholdController) currentSidePanel() types.Context { currentContext := self.c.Context().CurrentStatic() if currentContext.GetKey() == context.NORMAL_MAIN_CONTEXT_KEY ||