diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-19 09:31:52 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-19 12:12:57 +1100 |
commit | d93fef4c61db20dd9e2bb535c2fbb742cdbed60a (patch) | |
tree | 0e065ab7f334ea44b4597a79f6f8e36a018f2a15 /pkg/gui/context/list_context_trait.go | |
parent | 4b56d428ffda44cf433d7cfdd83ea99417ec3e86 (diff) |
use generics to DRY up context code
Diffstat (limited to 'pkg/gui/context/list_context_trait.go')
-rw-r--r-- | pkg/gui/context/list_context_trait.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index e508c8029..a10f0e3e9 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -27,7 +27,7 @@ func (self *ListContextTrait) GetViewTrait() types.IViewTrait { func (self *ListContextTrait) FocusLine() { // we need a way of knowing whether we've rendered to the view yet. self.viewTrait.FocusPoint(self.list.GetSelectedLineIdx()) - self.viewTrait.SetFooter(formatListFooter(self.list.GetSelectedLineIdx(), self.list.GetItemsLength())) + self.viewTrait.SetFooter(formatListFooter(self.list.GetSelectedLineIdx(), self.list.Len())) } func formatListFooter(selectedLineIdx int, length int) string { @@ -49,7 +49,7 @@ func (self *ListContextTrait) HandleFocusLost() error { // 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 { self.list.RefreshSelectedIdx() - content := utils.RenderDisplayStrings(self.getDisplayStrings(0, self.list.GetItemsLength())) + content := utils.RenderDisplayStrings(self.getDisplayStrings(0, self.list.Len())) self.viewTrait.SetContent(content) self.c.Render() |