From c6959046140355e72af51605c5fdc74681cac32c Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Sat, 13 Apr 2024 00:19:38 +1000 Subject: [PATCH] Prevent file showing at bottom during rename --- nav.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nav.go b/nav.go index 0a524d8a..c2dbf235 100644 --- a/nav.go +++ b/nav.go @@ -1566,9 +1566,13 @@ func (nav *nav) rename() error { dir := nav.loadDir(filepath.Dir(newPath)) if dir.loading { - file := &file{FileInfo: lstat} - dir.allFiles = append(dir.allFiles, file) - dir.files = append(dir.files, file) + for i := range dir.allFiles { + if dir.allFiles[i].path == oldPath { + dir.allFiles[i] = &file{FileInfo: lstat} + break + } + } + dir.sort() } dir.sel(lstat.Name(), nav.height)