diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-01-23 10:31:40 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-01-24 09:51:29 +0100 |
commit | eafb537081ed783daaa5b7455560d60eeb835230 (patch) | |
tree | 2d15b5b8781340e739c19ca992ebe95067852eb1 | |
parent | 50b0436510b0e256a64ccf365260c5f691cba3de (diff) | |
download | aerc-eafb537081ed783daaa5b7455560d60eeb835230.tar.gz |
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 <koni.marti@gmail.com>
-rw-r--r-- | widgets/dirlist.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 0345380c..e6f95e1a 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 } |