mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-29 22:07:13 +02:00
We want to show an error when the user tries to invoke an action that expects only a single item to be selected. We're using the GetDisabledReason field to enforce this (as well as DisabledReason on menu items). I've created a ListControllerTrait to store some shared convenience functions for this.
43 lines
907 B
Go
43 lines
907 B
Go
package controllers
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
)
|
|
|
|
type CommandLogController struct {
|
|
baseController
|
|
c *ControllerCommon
|
|
}
|
|
|
|
var _ types.IController = &CommandLogController{}
|
|
|
|
func NewCommandLogController(
|
|
c *ControllerCommon,
|
|
) *CommandLogController {
|
|
return &CommandLogController{
|
|
baseController: baseController{},
|
|
c: c,
|
|
}
|
|
}
|
|
|
|
func (self *CommandLogController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
|
bindings := []*types.Binding{}
|
|
|
|
return bindings
|
|
}
|
|
|
|
func (self *CommandLogController) GetOnFocusLost() func(types.OnFocusLostOpts) error {
|
|
return func(types.OnFocusLostOpts) error {
|
|
self.c.Views().Extras.Autoscroll = true
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func (self *CommandLogController) Context() types.Context {
|
|
return self.context()
|
|
}
|
|
|
|
func (self *CommandLogController) context() types.Context {
|
|
return self.c.Contexts().CommandLog
|
|
}
|