diff options
-rw-r--r-- | pkg/gui/context/list_context_trait.go | 8 | ||||
-rw-r--r-- | pkg/gui/context/local_commits_context.go | 8 | ||||
-rw-r--r-- | pkg/gui/context/sub_commits_context.go | 8 |
3 files changed, 14 insertions, 10 deletions
diff --git a/pkg/gui/context/list_context_trait.go b/pkg/gui/context/list_context_trait.go index e001bd3a7..e993719d5 100644 --- a/pkg/gui/context/list_context_trait.go +++ b/pkg/gui/context/list_context_trait.go @@ -21,7 +21,7 @@ type ListContextTrait struct { // TODO: now that we allow scrolling, we should be smarter about what gets refreshed: // we should find out exactly which lines are now part of the path and refresh those. // We should also keep track of the previous path and refresh those lines too. - refreshViewportOnLineFocus bool + refreshViewportOnChange bool } func (self *ListContextTrait) IsListContext() {} @@ -34,7 +34,7 @@ func (self *ListContextTrait) FocusLine() { self.GetViewTrait().FocusPoint(self.list.GetSelectedLineIdx()) self.setFooter() - if self.refreshViewportOnLineFocus { + if self.refreshViewportOnChange { self.refreshViewport() } } @@ -65,6 +65,10 @@ func (self *ListContextTrait) HandleFocus(opts types.OnFocusOpts) error { func (self *ListContextTrait) HandleFocusLost(opts types.OnFocusLostOpts) error { self.GetViewTrait().SetOriginX(0) + if self.refreshViewportOnChange { + self.refreshViewport() + } + return self.Context.HandleFocusLost(opts) } diff --git a/pkg/gui/context/local_commits_context.go b/pkg/gui/context/local_commits_context.go index 75c2a58fb..74363c52f 100644 --- a/pkg/gui/context/local_commits_context.go +++ b/pkg/gui/context/local_commits_context.go @@ -67,10 +67,10 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { Kind: types.SIDE_CONTEXT, Focusable: true, })), - list: viewModel, - getDisplayStrings: getDisplayStrings, - c: c, - refreshViewportOnLineFocus: true, + list: viewModel, + getDisplayStrings: getDisplayStrings, + c: c, + refreshViewportOnChange: true, }, } } diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index a88d96e08..e2c89aa14 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -72,10 +72,10 @@ func NewSubCommitsContext( Focusable: true, Transient: true, })), - list: viewModel, - getDisplayStrings: getDisplayStrings, - c: c, - refreshViewportOnLineFocus: true, + list: viewModel, + getDisplayStrings: getDisplayStrings, + c: c, + refreshViewportOnChange: true, }, } } |