1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Replace PopContext() with Context().Pop()

This commit is contained in:
Stefan Haller
2024-08-08 10:18:37 +02:00
parent bd36b8a95e
commit 98335361fd
11 changed files with 12 additions and 17 deletions

View File

@ -197,7 +197,7 @@ func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error {
return nil
}
if err := self.c.PopContext(); err != nil {
if err := self.c.Context().Pop(); err != nil {
return err
}

View File

@ -193,7 +193,7 @@ func (self *CommitsHelper) CloseCommitMessagePanel() error {
self.c.Views().CommitMessage.Visible = false
self.c.Views().CommitDescription.Visible = false
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *CommitsHelper) OpenCommitMenu(suggestionFunc func(string) []*types.Suggestion) error {

View File

@ -28,7 +28,7 @@ func (self *ConfirmationHelper) wrappedConfirmationFunction(cancel goContext.Can
return func() error {
cancel()
if err := self.c.PopContext(); err != nil {
if err := self.c.Context().Pop(); err != nil {
return err
}

View File

@ -34,7 +34,7 @@ func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)
// takes us from the patch building panel back to the commit files panel
func (self *PatchBuildingHelper) Escape() error {
return self.c.PopContext()
return self.c.Context().Pop()
}
// kills the custom patch and returns us back to the commit files panel if needed

View File

@ -118,7 +118,7 @@ func (self *SearchHelper) Confirm() error {
case types.SearchTypeSearch:
return self.ConfirmSearch()
case types.SearchTypeNone:
return self.c.PopContext()
return self.c.Context().Pop()
}
return nil
@ -140,7 +140,7 @@ func (self *SearchHelper) ConfirmFilter() error {
context.GetSearchHistory().Push(filterString)
}
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *SearchHelper) ConfirmSearch() error {
@ -158,7 +158,7 @@ func (self *SearchHelper) ConfirmSearch() error {
context.GetSearchHistory().Push(searchString)
}
if err := self.c.PopContext(); err != nil {
if err := self.c.Context().Pop(); err != nil {
return err
}
@ -183,7 +183,7 @@ func modelSearchResults(context types.ISearchableContext) []gocui.SearchPosition
func (self *SearchHelper) CancelPrompt() error {
self.Cancel()
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *SearchHelper) ScrollHistory(scrollIncrement int) {

View File

@ -79,7 +79,7 @@ func (self *MenuController) close() error {
return nil
}
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *MenuController) context() *context.MenuContext {

View File

@ -194,7 +194,7 @@ func (self *MergeConflictsController) context() *context.MergeConflictsContext {
}
func (self *MergeConflictsController) Escape() error {
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *MergeConflictsController) HandleEditFile() error {

View File

@ -172,7 +172,7 @@ func (self *StagingController) Escape() error {
return self.c.PostRefreshUpdate(self.context)
}
return self.c.PopContext()
return self.c.Context().Pop()
}
func (self *StagingController) TogglePanel() error {

View File

@ -17,7 +17,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
OnPress: func() error {
currentContext := gui.c.CurrentStaticContext()
if gui.c.State().GetShowExtrasWindow() && currentContext.GetKey() == context.COMMAND_LOG_CONTEXT_KEY {
if err := gui.c.PopContext(); err != nil {
if err := gui.c.Context().Pop(); err != nil {
return err
}
}

View File

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

View File

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