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>
This commit is contained in:
Koni Marti 2022-01-23 10:31:40 +01:00 committed by Robin Jarry
parent 50b0436510
commit eafb537081
1 changed files with 2 additions and 2 deletions

View File

@ -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
}