mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
cleaning up
This commit is contained in:
parent
e187293456
commit
09dc160da9
8 changed files with 34 additions and 54 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue