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:
parent
ebcd6fcea1
commit
6eed15c579
1 changed files with 2 additions and 3 deletions
|
@ -82,9 +82,9 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
|
||||||
textWidth = 0
|
textWidth = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
rowNr := 0
|
|
||||||
for i, node := range dt.list {
|
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
|
continue
|
||||||
}
|
}
|
||||||
row := rowNr - dt.Scroll()
|
row := rowNr - dt.Scroll()
|
||||||
|
@ -93,7 +93,6 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
name := dt.displayText(node)
|
name := dt.displayText(node)
|
||||||
rowNr++
|
|
||||||
|
|
||||||
dirStyle := []config.StyleObject{}
|
dirStyle := []config.StyleObject{}
|
||||||
path := dt.getDirectory(node)
|
path := dt.getDirectory(node)
|
||||||
|
|
Loading…
Reference in a new issue