summaryrefslogtreecommitdiffstats
path: root/pkg/gui/context/list_context_trait.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-06-01 19:28:26 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-06-01 21:31:57 +1000
commitc9136538b5cd2d86c90ed0921ba5f716f3cb6d85 (patch)
tree0a6763bfffc056f2d64c35eeabdc8434a33ece58 /pkg/gui/context/list_context_trait.go
parentcaab31ff38b4bd1ee7172e24a7ee3dcd8681be33 (diff)
Refresh commits viewport on focus lost
We don't want the highlighted selection sticking around after the context loses focus.
Diffstat (limited to 'pkg/gui/context/list_context_trait.go')
-rw-r--r--pkg/gui/context/list_context_trait.go8
1 files changed, 6 insertions, 2 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)
}