From eafb537081ed783daaa5b7455560d60eeb835230 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Sun, 23 Jan 2022 10:31:40 +0100 Subject: [PATCH] dirlist: improve change-folder responsiveness improves change-folder responsiveness. When changing folders, the highlighted directory is currently updated in a callback function to the open-directory action. This creates an unpleasent lag in the ui until the entire operation is done. Instead, we should provide an immediate visual feedback of the selection to the user and keep loading the directory contents in the background. Signed-off-by: Koni Marti --- widgets/dirlist.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 0345380..e6f95e1 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -238,7 +238,7 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) { } style := dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT) - if name == dirlist.selected { + if name == dirlist.selecting { style = dirlist.UiConfig().GetStyleSelected(config.STYLE_DIRLIST_DEFAULT) } ctx.Fill(0, row, textWidth, 1, ' ', style) @@ -332,7 +332,7 @@ func (dirlist *DirectoryList) Clicked(x int, y int) (string, bool) { } func (dirlist *DirectoryList) NextPrev(delta int) { - curIdx := findString(dirlist.dirs, dirlist.selected) + curIdx := findString(dirlist.dirs, dirlist.selecting) if curIdx == len(dirlist.dirs) { return }