mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-23 00:39:13 +02:00
refactor contexts code
This commit is contained in:
@ -3,18 +3,16 @@ package gui
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/popup"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
// hacking this by including the gui struct for now until we split more things out
|
||||
type guiCommon struct {
|
||||
gui *Gui
|
||||
popup.IPopupHandler
|
||||
types.IPopupHandler
|
||||
}
|
||||
|
||||
var _ controllers.IGuiCommon = &guiCommon{}
|
||||
var _ types.IGuiCommon = &guiCommon{}
|
||||
|
||||
func (self *guiCommon) LogAction(msg string) {
|
||||
self.gui.LogAction(msg)
|
||||
@ -44,6 +42,10 @@ func (self *guiCommon) PopContext() error {
|
||||
return self.gui.returnFromContext()
|
||||
}
|
||||
|
||||
func (self *guiCommon) CurrentContext() types.Context {
|
||||
return self.gui.currentContext()
|
||||
}
|
||||
|
||||
func (self *guiCommon) GetAppState() *config.AppState {
|
||||
return self.gui.Config.GetAppState()
|
||||
}
|
||||
@ -51,3 +53,11 @@ func (self *guiCommon) GetAppState() *config.AppState {
|
||||
func (self *guiCommon) SaveAppState() error {
|
||||
return self.gui.Config.SaveAppState()
|
||||
}
|
||||
|
||||
func (self *guiCommon) Render() {
|
||||
self.gui.render()
|
||||
}
|
||||
|
||||
func (self *guiCommon) OpenSearch() {
|
||||
_ = self.gui.handleOpenSearch(self.gui.currentViewName())
|
||||
}
|
||||
|
Reference in New Issue
Block a user