mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Replace CurrentSideContext() with Context().CurrentSide()
This commit is contained in:
@ -14,7 +14,7 @@ type FilteringMenuAction struct {
|
|||||||
func (self *FilteringMenuAction) Call() error {
|
func (self *FilteringMenuAction) Call() error {
|
||||||
fileName := ""
|
fileName := ""
|
||||||
author := ""
|
author := ""
|
||||||
switch self.c.CurrentSideContext() {
|
switch self.c.Context().CurrentSide() {
|
||||||
case self.c.Contexts().Files:
|
case self.c.Contexts().Files:
|
||||||
node := self.c.Contexts().Files.GetSelected()
|
node := self.c.Contexts().Files.GetSelected()
|
||||||
if node != nil {
|
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
|
// 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.
|
// flicking through branches it will be using the local branch name.
|
||||||
func (self *DiffHelper) CurrentDiffTerminals() []string {
|
func (self *DiffHelper) CurrentDiffTerminals() []string {
|
||||||
c := self.c.CurrentSideContext()
|
c := self.c.Context().CurrentSide()
|
||||||
|
|
||||||
if c.GetKey() == "" {
|
if c.GetKey() == "" {
|
||||||
return nil
|
return nil
|
||||||
|
@ -89,7 +89,7 @@ func (self *WindowArrangementHelper) GetWindowDimensions(informationStr string,
|
|||||||
Height: height,
|
Height: height,
|
||||||
UserConfig: self.c.UserConfig,
|
UserConfig: self.c.UserConfig,
|
||||||
CurrentWindow: self.windowHelper.CurrentWindow(),
|
CurrentWindow: self.windowHelper.CurrentWindow(),
|
||||||
CurrentSideWindow: self.c.CurrentSideContext().GetWindowName(),
|
CurrentSideWindow: self.c.Context().CurrentSide().GetWindowName(),
|
||||||
CurrentStaticWindow: self.c.Context().CurrentStatic().GetWindowName(),
|
CurrentStaticWindow: self.c.Context().CurrentStatic().GetWindowName(),
|
||||||
SplitMainPanel: repoState.GetSplitMainPanel(),
|
SplitMainPanel: repoState.GetSplitMainPanel(),
|
||||||
ScreenMode: repoState.GetScreenMode(),
|
ScreenMode: repoState.GetScreenMode(),
|
||||||
|
@ -28,5 +28,5 @@ func (self *ToggleWhitespaceAction) Call() error {
|
|||||||
self.c.GetAppState().IgnoreWhitespaceInDiffView = !self.c.GetAppState().IgnoreWhitespaceInDiffView
|
self.c.GetAppState().IgnoreWhitespaceInDiffView = !self.c.GetAppState().IgnoreWhitespaceInDiffView
|
||||||
self.c.SaveAppStateAndLogError()
|
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 {
|
func (gui *Gui) handleFocusCommandLog() error {
|
||||||
gui.c.State().SetShowExtrasWindow(true)
|
gui.c.State().SetShowExtrasWindow(true)
|
||||||
// TODO: is this necessary? Can't I just call 'return from context'?
|
// 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)
|
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 {
|
func (gui *Gui) handleCopySelectedSideContextItemToClipboardWithTruncation(maxWidth int) error {
|
||||||
// important to note that this assumes we've selected an item in a side context
|
// 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 {
|
if currentSideContext == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ func (gui *Gui) handleCopySelectedSideContextItemToClipboardWithTruncation(maxWi
|
|||||||
|
|
||||||
func (gui *Gui) getCopySelectedSideContextItemToClipboardDisabledReason() *types.DisabledReason {
|
func (gui *Gui) getCopySelectedSideContextItemToClipboardDisabledReason() *types.DisabledReason {
|
||||||
// important to note that this assumes we've selected an item in a side context
|
// 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 {
|
if currentSideContext == nil {
|
||||||
// This should never happen but if it does we'll just ignore the keypress
|
// This should never happen but if it does we'll just ignore the keypress
|
||||||
return nil
|
return nil
|
||||||
|
@ -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) CurrentSideContext() types.Context {
|
|
||||||
return self.gui.State.ContextMgr.CurrentSide()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *guiCommon) CurrentPopupContexts() []types.Context {
|
func (self *guiCommon) CurrentPopupContexts() []types.Context {
|
||||||
return self.gui.State.ContextMgr.PopupContexts()
|
return self.gui.State.ContextMgr.PopupContexts()
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
CurrentSideContext() Context
|
|
||||||
CurrentPopupContexts() []Context
|
CurrentPopupContexts() []Context
|
||||||
IsCurrentContext(Context) bool
|
IsCurrentContext(Context) bool
|
||||||
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
|
// TODO: replace the above context-based methods with just using Context() e.g. replace PushContext() with Context().Push()
|
||||||
|
Reference in New Issue
Block a user