diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-10-19 11:22:33 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-10-19 20:27:24 +0200 |
commit | 6eed15c579017099c31d73821e70bc363e0fe7b8 (patch) | |
tree | f13adf3f36dcf591050c267dca12432dc4054201 /widgets/dirtree.go | |
parent | ebcd6fcea1517b00153214e3284d6307809175f5 (diff) | |
download | aerc-6eed15c579017099c31d73821e70bc363e0fe7b8.tar.gz |
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>
Diffstat (limited to 'widgets/dirtree.go')
-rw-r--r-- | widgets/dirtree.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/widgets/dirtree.go b/widgets/dirtree.go index eae2f7d1..68ff32f0 100644 --- a/widgets/dirtree.go +++ b/widgets/dirtree.go @@ -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) |