cleaning up

This commit is contained in:
Jesse Duffield 2022-01-30 11:22:47 +11:00
parent e187293456
commit 09dc160da9
8 changed files with 34 additions and 54 deletions

View file

@ -9,14 +9,8 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
type Thing interface {
// the boolean here tells us whether the item is nil. This is needed because you can't work it out on the calling end once the pointer is wrapped in an interface (unless you want to use reflection)
GetSelectedItem() (types.ListItem, bool)
}
type ListContextTrait struct {
base types.IBaseContext
thing Thing
listTrait *ListTrait
viewTrait *ViewTrait
@ -55,16 +49,6 @@ func formatListFooter(selectedLineIdx int, length int) string {
return fmt.Sprintf("%d of %d", selectedLineIdx+1, length)
}
func (self *ListContextTrait) GetSelectedItemId() string {
item, ok := self.thing.GetSelectedItem()
if !ok {
return ""
}
return item.ID()
}
// OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view
func (self *ListContextTrait) HandleRender() error {
if self.GetDisplayStrings != nil {