mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +02:00
Replace CurrentStaticContext() with Context().CurrentStatic()
This commit is contained in:
parent
7ed94c0410
commit
7f935c1ea8
@ -94,7 +94,7 @@ func (self *ContextLinesController) applyChange() error {
|
||||
self.c.Toast(fmt.Sprintf(self.c.Tr.DiffContextSizeChanged, self.c.AppState.DiffContextSize))
|
||||
self.c.SaveAppStateAndLogError()
|
||||
|
||||
currentContext := self.c.CurrentStaticContext()
|
||||
currentContext := self.c.Context().CurrentStatic()
|
||||
switch currentContext.GetKey() {
|
||||
// we make an exception for our staging and patch building contexts because they actually need to refresh their state afterwards.
|
||||
case context.PATCH_BUILDING_MAIN_CONTEXT_KEY:
|
||||
@ -117,6 +117,6 @@ func (self *ContextLinesController) checkCanChangeContext() error {
|
||||
func (self *ContextLinesController) isShowingDiff() bool {
|
||||
return lo.Contains(
|
||||
CONTEXT_KEYS_SHOWING_DIFFS,
|
||||
self.c.CurrentStaticContext().GetKey(),
|
||||
self.c.Context().CurrentStatic().GetKey(),
|
||||
)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func (self *PatchBuildingHelper) Escape() error {
|
||||
func (self *PatchBuildingHelper) Reset() error {
|
||||
self.c.Git().Patch.PatchBuilder.Reset()
|
||||
|
||||
if self.c.CurrentStaticContext().GetKind() != types.SIDE_CONTEXT {
|
||||
if self.c.Context().CurrentStatic().GetKind() != types.SIDE_CONTEXT {
|
||||
if err := self.Escape(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -114,9 +114,9 @@ func (self *StagingHelper) handleStagingEscape() error {
|
||||
}
|
||||
|
||||
func (self *StagingHelper) secondaryStagingFocused() bool {
|
||||
return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().StagingSecondary.GetKey()
|
||||
return self.c.Context().CurrentStatic().GetKey() == self.c.Contexts().StagingSecondary.GetKey()
|
||||
}
|
||||
|
||||
func (self *StagingHelper) mainStagingFocused() bool {
|
||||
return self.c.CurrentStaticContext().GetKey() == self.c.Contexts().Staging.GetKey()
|
||||
return self.c.Context().CurrentStatic().GetKey() == self.c.Contexts().Staging.GetKey()
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string,
|
||||
UserConfig: self.c.UserConfig,
|
||||
CurrentWindow: self.windowHelper.CurrentWindow(),
|
||||
CurrentSideWindow: self.c.CurrentSideContext().GetWindowName(),
|
||||
CurrentStaticWindow: self.c.CurrentStaticContext().GetWindowName(),
|
||||
CurrentStaticWindow: self.c.Context().CurrentStatic().GetWindowName(),
|
||||
SplitMainPanel: repoState.GetSplitMainPanel(),
|
||||
ScreenMode: repoState.GetScreenMode(),
|
||||
AppStatus: appStatus,
|
||||
|
@ -82,7 +82,7 @@ func (self *RenameSimilarityThresholdController) applyChange() error {
|
||||
self.c.Toast(fmt.Sprintf(self.c.Tr.RenameSimilarityThresholdChanged, self.c.AppState.RenameSimilarityThreshold))
|
||||
self.c.SaveAppStateAndLogError()
|
||||
|
||||
currentContext := self.c.CurrentStaticContext()
|
||||
currentContext := self.c.Context().CurrentStatic()
|
||||
switch currentContext.GetKey() {
|
||||
// we make an exception for our files context, because it actually need to refresh its state afterwards.
|
||||
case context.FILES_CONTEXT_KEY:
|
||||
@ -95,6 +95,6 @@ func (self *RenameSimilarityThresholdController) applyChange() error {
|
||||
func (self *RenameSimilarityThresholdController) isShowingRenames() bool {
|
||||
return lo.Contains(
|
||||
CONTEXT_KEYS_SHOWING_RENAMES,
|
||||
self.c.CurrentStaticContext().GetKey(),
|
||||
self.c.Context().CurrentStatic().GetKey(),
|
||||
)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
|
||||
{
|
||||
Label: gui.c.Tr.ToggleShowCommandLog,
|
||||
OnPress: func() error {
|
||||
currentContext := gui.c.CurrentStaticContext()
|
||||
currentContext := gui.c.Context().CurrentStatic()
|
||||
if gui.c.State().GetShowExtrasWindow() && currentContext.GetKey() == context.COMMAND_LOG_CONTEXT_KEY {
|
||||
if err := gui.c.Context().Pop(); err != nil {
|
||||
return err
|
||||
|
@ -45,10 +45,6 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
|
||||
return self.gui.runSubprocessWithSuspense(cmdObj)
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentStaticContext() types.Context {
|
||||
return self.gui.State.ContextMgr.CurrentStatic()
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentSideContext() types.Context {
|
||||
return self.gui.State.ContextMgr.CurrentSide()
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ type IGuiCommon interface {
|
||||
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error)
|
||||
RunSubprocessAndRefresh(oscommands.ICmdObj) error
|
||||
|
||||
CurrentStaticContext() Context
|
||||
CurrentSideContext() Context
|
||||
CurrentPopupContexts() []Context
|
||||
IsCurrentContext(Context) bool
|
||||
|
@ -119,7 +119,7 @@ func (gui *Gui) handlePrevTab() error {
|
||||
|
||||
func getTabbedView(gui *Gui) *gocui.View {
|
||||
// It safe assumption that only static contexts have tabs
|
||||
context := gui.c.CurrentStaticContext()
|
||||
context := gui.c.Context().CurrentStatic()
|
||||
view, _ := gui.g.View(context.GetViewName())
|
||||
return view
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user