2021-04-11 05:17:20 +02:00
|
|
|
package gui
|
|
|
|
|
2022-01-16 05:46:53 +02:00
|
|
|
import (
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
|
|
)
|
2021-04-11 05:17:20 +02:00
|
|
|
|
2022-01-31 13:20:28 +02:00
|
|
|
func (gui *Gui) contextTree() *context.ContextTree {
|
2023-03-23 09:47:29 +02:00
|
|
|
contextCommon := &context.ContextCommon{
|
|
|
|
IGuiCommon: gui.c.IGuiCommon,
|
|
|
|
Common: gui.c.Common,
|
2021-04-11 05:17:20 +02:00
|
|
|
}
|
2023-03-23 09:47:29 +02:00
|
|
|
return context.NewContextTree(contextCommon)
|
2021-04-11 05:17:20 +02:00
|
|
|
}
|
|
|
|
|
2021-11-21 03:48:49 +02:00
|
|
|
// using this wrapper for when an onFocus function doesn't care about any potential
|
|
|
|
// props that could be passed
|
2022-06-13 03:01:26 +02:00
|
|
|
func OnFocusWrapper(f func() error) func(opts types.OnFocusOpts) error {
|
|
|
|
return func(opts types.OnFocusOpts) error {
|
2021-11-21 03:48:49 +02:00
|
|
|
return f()
|
|
|
|
}
|
|
|
|
}
|
2022-06-13 03:01:26 +02:00
|
|
|
|
2022-12-30 14:24:24 +02:00
|
|
|
func (gui *Gui) defaultSideContext() types.Context {
|
|
|
|
if gui.State.Modes.Filtering.Active() {
|
|
|
|
return gui.State.Contexts.LocalCommits
|
|
|
|
} else {
|
|
|
|
return gui.State.Contexts.Files
|
|
|
|
}
|
|
|
|
}
|