summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/list_context_trait.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/gui/context/list_context_trait.go')
-rw-r--r--pkg/gui/context/list_context_trait.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go
index e993719d5..de88d3d3b 100644
--- a/pkg/gui/context/list_context_trait.go
+++ b/pkg/gui/context/list_context_trait.go
@@ -31,7 +31,14 @@ func (self *ListContextTrait) GetList() types.IList {
}
func (self *ListContextTrait) FocusLine() {
- self.GetViewTrait().FocusPoint(self.list.GetSelectedLineIdx())
+ // Doing this at the end of the layout function because we need the view to be
+ // resized before we focus the line, otherwise if we're in accordion mode
+ // the view could be squashed and won't how to adjust the cursor/origin
+ self.c.AfterLayout(func() error {
+ self.GetViewTrait().FocusPoint(self.list.GetSelectedLineIdx())
+ return nil
+ })
+
self.setFooter()
if self.refreshViewportOnChange {