mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Replace CurrentSideContext() with Context().CurrentSide()
This commit is contained in:
parent
7f935c1ea8
commit
df3afb1b89
8 changed files with 7 additions and 12 deletions
|
@ -14,7 +14,7 @@ type FilteringMenuAction struct {
|
|||
func (self *FilteringMenuAction) Call() error {
|
||||
fileName := ""
|
||||
author := ""
|
||||
switch self.c.CurrentSideContext() {
|
||||
switch self.c.Context().CurrentSide() {
|
||||
case self.c.Contexts().Files:
|
||||
node := self.c.Contexts().Files.GetSelected()
|
||||
if node != nil {
|
||||
|
|
|
@ -70,7 +70,7 @@ func (self *DiffHelper) RenderDiff() error {
|
|||
// which becomes an option when you bring up the diff menu, but when you're just
|
||||
// flicking through branches it will be using the local branch name.
|
||||
func (self *DiffHelper) CurrentDiffTerminals() []string {
|
||||
c := self.c.CurrentSideContext()
|
||||
c := self.c.Context().CurrentSide()
|
||||
|
||||
if c.GetKey() == "" {
|
||||
return nil
|
||||
|
|
|
@ -89,7 +89,7 @@ func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string,
|
|||
Height: height,
|
||||
UserConfig: self.c.UserConfig,
|
||||
CurrentWindow: self.windowHelper.CurrentWindow(),
|
||||
CurrentSideWindow: self.c.CurrentSideContext().GetWindowName(),
|
||||
CurrentSideWindow: self.c.Context().CurrentSide().GetWindowName(),
|
||||
CurrentStaticWindow: self.c.Context().CurrentStatic().GetWindowName(),
|
||||
SplitMainPanel: repoState.GetSplitMainPanel(),
|
||||
ScreenMode: repoState.GetScreenMode(),
|
||||
|
|
|
@ -28,5 +28,5 @@ func (self *ToggleWhitespaceAction) Call() error {
|
|||
self.c.GetAppState().IgnoreWhitespaceInDiffView = !self.c.GetAppState().IgnoreWhitespaceInDiffView
|
||||
self.c.SaveAppStateAndLogError()
|
||||
|
||||
return self.c.CurrentSideContext().HandleFocus(types.OnFocusOpts{})
|
||||
return self.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{})
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func (gui *Gui) handleCreateExtrasMenuPanel() error {
|
|||
func (gui *Gui) handleFocusCommandLog() error {
|
||||
gui.c.State().SetShowExtrasWindow(true)
|
||||
// TODO: is this necessary? Can't I just call 'return from context'?
|
||||
gui.State.Contexts.CommandLog.SetParentContext(gui.c.CurrentSideContext())
|
||||
gui.State.Contexts.CommandLog.SetParentContext(gui.c.Context().CurrentSide())
|
||||
return gui.c.Context().Push(gui.State.Contexts.CommandLog)
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ func (gui *Gui) handleCopySelectedSideContextItemCommitHashToClipboard() error {
|
|||
|
||||
func (gui *Gui) handleCopySelectedSideContextItemToClipboardWithTruncation(maxWidth int) error {
|
||||
// important to note that this assumes we've selected an item in a side context
|
||||
currentSideContext := gui.c.CurrentSideContext()
|
||||
currentSideContext := gui.c.Context().CurrentSide()
|
||||
if currentSideContext == nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ func (gui *Gui) handleCopySelectedSideContextItemToClipboardWithTruncation(maxWi
|
|||
|
||||
func (gui *Gui) getCopySelectedSideContextItemToClipboardDisabledReason() *types.DisabledReason {
|
||||
// important to note that this assumes we've selected an item in a side context
|
||||
currentSideContext := gui.c.CurrentSideContext()
|
||||
currentSideContext := gui.c.Context().CurrentSide()
|
||||
if currentSideContext == nil {
|
||||
// This should never happen but if it does we'll just ignore the keypress
|
||||
return nil
|
||||
|
|
|
@ -45,10 +45,6 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
|
|||
return self.gui.runSubprocessWithSuspense(cmdObj)
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentSideContext() types.Context {
|
||||
return self.gui.State.ContextMgr.CurrentSide()
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentPopupContexts() []types.Context {
|
||||
return self.gui.State.ContextMgr.PopupContexts()
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ type IGuiCommon interface {
|
|||
RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error)
|
||||
RunSubprocessAndRefresh(oscommands.ICmdObj) error
|
||||
|
||||
CurrentSideContext() Context
|
||||
CurrentPopupContexts() []Context
|
||||
IsCurrentContext(Context) bool
|
||||
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue