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:
parent
50b0436510
commit
eafb537081
|
@ -238,7 +238,7 @@ func (dirlist *DirectoryList) Draw(ctx *ui.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
style := dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT)
|
style := dirlist.UiConfig().GetStyle(config.STYLE_DIRLIST_DEFAULT)
|
||||||
if name == dirlist.selected {
|
if name == dirlist.selecting {
|
||||||
style = dirlist.UiConfig().GetStyleSelected(config.STYLE_DIRLIST_DEFAULT)
|
style = dirlist.UiConfig().GetStyleSelected(config.STYLE_DIRLIST_DEFAULT)
|
||||||
}
|
}
|
||||||
ctx.Fill(0, row, textWidth, 1, ' ', style)
|
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) {
|
func (dirlist *DirectoryList) NextPrev(delta int) {
|
||||||
curIdx := findString(dirlist.dirs, dirlist.selected)
|
curIdx := findString(dirlist.dirs, dirlist.selecting)
|
||||||
if curIdx == len(dirlist.dirs) {
|
if curIdx == len(dirlist.dirs) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue