dirtree: fix folder scrolling

Fix scrolling by correcting the index calculation.

Fixes: https://todo.sr.ht/~rjarry/aerc/93
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Tested-by: Inwit <inwit@sindominio.net>
This commit is contained in:
Koni Marti 2022-10-19 11:22:33 +02:00 committed by Robin Jarry
parent ebcd6fcea1
commit 6eed15c579
1 changed files with 2 additions and 3 deletions

View File

@ -82,9 +82,9 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
textWidth = 0
}
rowNr := 0
for i, node := range dt.list {
if i < dt.Scroll() || !isVisible(node) {
rowNr := dt.countVisible(dt.list[:i])
if rowNr < dt.Scroll() || !isVisible(node) {
continue
}
row := rowNr - dt.Scroll()
@ -93,7 +93,6 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
}
name := dt.displayText(node)
rowNr++
dirStyle := []config.StyleObject{}
path := dt.getDirectory(node)