From 478d51c83e4a6c5fba9521e8895c4737cf0cdd5e Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 22 Dec 2025 17:58:05 +0100 Subject: [PATCH] When pressing up or down, scroll selection into view if it is outside, even if it didn't change We have this logic to avoid constantly rerendering the main view when hitting up-arrow when you are already at the top of the list. That's good, but we do want to scroll the selection into view if it is outside and you hit up or down, no matter if it changed. --- pkg/gui/controllers/list_controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/gui/controllers/list_controller.go b/pkg/gui/controllers/list_controller.go index 27c3f402e..a91074392 100644 --- a/pkg/gui/controllers/list_controller.go +++ b/pkg/gui/controllers/list_controller.go @@ -117,6 +117,11 @@ func (self *ListController) handleLineChangeAux(f func(int), change int) error { if cursorMoved || rangeBefore != rangeAfter { self.context.HandleFocus(types.OnFocusOpts{ScrollSelectionIntoView: true}) + } else { + // If the selection did not change (because, for example, we are at the top of the list and + // press up), we still want to ensure that the selection is visible. This is useful after + // scrolling the selection out of view with the mouse. + self.context.FocusLine(true) } return nil