summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui_common.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/gui_common.go')
-rw-r--r--pkg/gui/gui_common.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/pkg/gui/gui_common.go b/pkg/gui/gui_common.go
index 89abe92ba..587a7fb86 100644
--- a/pkg/gui/gui_common.go
+++ b/pkg/gui/gui_common.go
@@ -1,6 +1,8 @@
package gui
import (
+ "errors"
+
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/gui/types"
@@ -39,7 +41,17 @@ func (self *guiCommon) RunSubprocess(cmdObj oscommands.ICmdObj) (bool, error) {
}
func (self *guiCommon) PushContext(context types.Context, opts ...types.OnFocusOpts) error {
- return self.gui.pushContext(context, opts...)
+ singleOpts := types.OnFocusOpts{}
+ if len(opts) > 0 {
+ // using triple dot but you should only ever pass one of these opt structs
+ if len(opts) > 1 {
+ return errors.New("cannot pass multiple opts to pushContext")
+ }
+
+ singleOpts = opts[0]
+ }
+
+ return self.gui.pushContext(context, singleOpts)
}
func (self *guiCommon) PopContext() error {
@@ -50,6 +62,14 @@ func (self *guiCommon) CurrentContext() types.Context {
return self.gui.currentContext()
}
+func (self *guiCommon) CurrentStaticContext() types.Context {
+ return self.gui.currentStaticContext()
+}
+
+func (self *guiCommon) IsCurrentContext(c types.Context) bool {
+ return self.CurrentContext().GetKey() == c.GetKey()
+}
+
func (self *guiCommon) GetAppState() *config.AppState {
return self.gui.Config.GetAppState()
}