select new file after rename

Related #197
This commit is contained in:
Gokcehan committed 2020-07-17 00:28:32 +03:00
1 parent e7fb56391f
commit 2f056ad359
2 files changed
+32 -12

No files matched your search

+8 -5
View File
@@ -854,18 +854,21 @@ func (nav *nav) rename() error {
oldPath := nav.renameOldPath
newPath := nav.renameNewPath
dir, _ := filepath.Split(newPath)
os.MkdirAll(dir, os.ModePerm)
if err := os.Rename(oldPath, newPath); err != nil {
return err
}
// TODO: change selection
if err := nav.sel(newPath); err != nil {
lstat, err := os.Lstat(newPath)
if err != nil {
return err
}
dir := nav.loadDir(filepath.Dir(newPath))
dir.files = append(dir.files, &file{FileInfo: lstat})
dir.sel(lstat.Name(), nav.height)
nav.checkDir(dir)
return nil
}