1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Replace ReplaceContext() with Context().Replace()

This commit is contained in:
Stefan Haller
2024-08-08 10:21:30 +02:00
parent 98335361fd
commit 111d10fe5c
6 changed files with 4 additions and 9 deletions

View File

@ -53,7 +53,7 @@ func (self *CommitDescriptionController) context() *context.CommitMessageContext
} }
func (self *CommitDescriptionController) switchToCommitMessage() error { func (self *CommitDescriptionController) switchToCommitMessage() error {
return self.c.ReplaceContext(self.c.Contexts().CommitMessage) return self.c.Context().Replace(self.c.Contexts().CommitMessage)
} }
func (self *CommitDescriptionController) close() error { func (self *CommitDescriptionController) close() error {

View File

@ -85,7 +85,7 @@ func (self *CommitMessageController) handleNextCommit() error {
} }
func (self *CommitMessageController) switchToCommitDescription() error { func (self *CommitMessageController) switchToCommitDescription() error {
if err := self.c.ReplaceContext(self.c.Contexts().CommitDescription); err != nil { if err := self.c.Context().Replace(self.c.Contexts().CommitDescription); err != nil {
return err return err
} }
return nil return nil

View File

@ -49,7 +49,7 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [
self.c.UserConfig.Keybinding.Universal.Remove, self.c.UserConfig.Keybinding.Universal.Edit) self.c.UserConfig.Keybinding.Universal.Remove, self.c.UserConfig.Keybinding.Universal.Edit)
} }
self.c.Views().Suggestions.Subtitle = subtitle self.c.Views().Suggestions.Subtitle = subtitle
return self.c.ReplaceContext(self.c.Contexts().Suggestions) return self.c.Context().Replace(self.c.Contexts().Suggestions)
} }
return nil return nil
}, },

View File

@ -72,7 +72,7 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
func (self *SuggestionsController) switchToConfirmation() error { func (self *SuggestionsController) switchToConfirmation() error {
self.c.Views().Suggestions.Subtitle = "" self.c.Views().Suggestions.Subtitle = ""
self.c.Views().Suggestions.Highlight = false self.c.Views().Suggestions.Highlight = false
return self.c.ReplaceContext(self.c.Contexts().Confirmation) return self.c.Context().Replace(self.c.Contexts().Confirmation)
} }
func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) error { func (self *SuggestionsController) GetOnFocusLost() func(types.OnFocusLostOpts) error {

View File

@ -45,10 +45,6 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
return self.gui.runSubprocessWithSuspense(cmdObj) return self.gui.runSubprocessWithSuspense(cmdObj)
} }
func (self *guiCommon) ReplaceContext(context types.Context) error {
return self.gui.State.ContextMgr.Replace(context)
}
func (self *guiCommon) RemoveContexts(contexts []types.Context) error { func (self *guiCommon) RemoveContexts(contexts []types.Context) error {
return self.gui.State.ContextMgr.RemoveContexts(contexts) return self.gui.State.ContextMgr.RemoveContexts(contexts)
} }

View File

@ -57,7 +57,6 @@ type IGuiCommon interface {
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error)
RunSubprocessAndRefresh(oscommands.ICmdObj) error RunSubprocessAndRefresh(oscommands.ICmdObj) error
ReplaceContext(context Context) error
// Removes all given contexts from the stack. If a given context is not in the stack, it is ignored. // Removes all given contexts from the stack. If a given context is not in the stack, it is ignored.
// This is for when you have a group of contexts that are bundled together e.g. with the commit message panel. // This is for when you have a group of contexts that are bundled together e.g. with the commit message panel.
// If you want to remove a single context, you should probably use PopContext instead. // If you want to remove a single context, you should probably use PopContext instead.