1
0
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:
Jesse Duffield
2022-01-29 19:09:20 +11:00
parent 1a74ed3214
commit 138be04e65
60 changed files with 1154 additions and 602 deletions

View File

@ -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())
}