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 {
return self.c.ReplaceContext(self.c.Contexts().CommitMessage)
return self.c.Context().Replace(self.c.Contexts().CommitMessage)
}
func (self *CommitDescriptionController) close() error {

View file

@ -85,7 +85,7 @@ func (self *CommitMessageController) handleNextCommit() 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 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.Views().Suggestions.Subtitle = subtitle
return self.c.ReplaceContext(self.c.Contexts().Suggestions)
return self.c.Context().Replace(self.c.Contexts().Suggestions)
}
return nil
},

View file

@ -72,7 +72,7 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
func (self *SuggestionsController) switchToConfirmation() error {
self.c.Views().Suggestions.Subtitle = ""
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 {

View file

@ -45,10 +45,6 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
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 {
return self.gui.State.ContextMgr.RemoveContexts(contexts)
}

View file

@ -57,7 +57,6 @@ type IGuiCommon interface {
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, 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.
// 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.