add keyboard based movement on the file tree

This commit is contained in:
2026-01-01 01:03:32 +00:00
parent b6c461df7c
commit 7b18904775
4 changed files with 118 additions and 3 deletions
+9
View File
@@ -12,6 +12,7 @@ import (
"errors"
"os"
"path/filepath"
"sort"
)
func walkFileSystemAndBuildTree(rootPath string, node *FsNode) error {
@@ -60,6 +61,14 @@ func walkFileSystemAndBuildTree(rootPath string, node *FsNode) error {
}
}
// Sort children: files first, then folders
sort.Slice(node.children, func(i, j int) bool {
if node.children[i].nodeType == node.children[j].nodeType {
return node.children[i].FileName() < node.children[j].FileName()
}
return node.children[i].nodeType == FileNode
})
return nil
}