Prevent scrolling to bottom when selecting files (#1222)
* Prevent scrolling to bottom when selecting files * Use nav.currDir()
This commit is contained in:
1 parent
f04401ba4d
commit
35990bed12
1 file changed
+10
-3
@@ -486,7 +486,9 @@ func (nav *nav) getDirs(wd string) {
|
||||
|
||||
for curr, base := wd, ""; !isRoot(base); curr, base = filepath.Dir(curr), filepath.Base(curr) {
|
||||
dir := nav.loadDir(curr)
|
||||
dir.sel(base, nav.height)
|
||||
if base != "" {
|
||||
dir.sel(base, nav.height)
|
||||
}
|
||||
dirs = append(dirs, dir)
|
||||
}
|
||||
|
||||
@@ -1540,13 +1542,18 @@ func (nav *nav) sel(path string) error {
|
||||
|
||||
base := filepath.Base(path)
|
||||
|
||||
last := nav.dirs[len(nav.dirs)-1]
|
||||
last := nav.currDir()
|
||||
|
||||
if last.loading {
|
||||
last.files = append(last.files, &file{FileInfo: lstat})
|
||||
}
|
||||
|
||||
last.sel(base, nav.height)
|
||||
for i, f := range last.files {
|
||||
if f.Name() == base {
|
||||
nav.move(i)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user