summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-11-08 08:23:39 +0100
committerqkzk <qu3nt1n@gmail.com>2023-11-08 08:23:39 +0100
commit9b847e37543f4e610fe238ff90a23799287e84c8 (patch)
treeab302de653b3e663c8e66ee2f141d17509a46d1d
parent8e53337b880c6e3080b3066944567bee3365a6d4 (diff)
rename a variable
-rw-r--r--development.md2
-rw-r--r--src/tree.rs10
2 files changed, 6 insertions, 6 deletions
diff --git a/development.md b/development.md
index 87310f5..1b32417 100644
--- a/development.md
+++ b/development.md
@@ -602,10 +602,10 @@ New view: Tree ! Toggle with 't', fold with 'z'. Navigate normally.
- [x] FIX: exploring root folder leads to wrong first line display.
- [x] allow seveval palettes for normal file colors
- [x] move every lazy_static configuration into config.
+- [x] FIX: encrypted are never shown as mounted
- [ ] mount usb key - should be merged with mtp
- [ ] document filepicking (from my config etc.).
- [ ] avoid multiple refreshs if we edit files ourself
-- [x] FIX: encrypted are never shown as mounted
- [ ] Tree remade without recursion. Improve ram usage
- [x] FIX: folders are max depth hangs the app
- [x] FIX: rename renames the root path
diff --git a/src/tree.rs b/src/tree.rs
index f495acb..e78592f 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -156,15 +156,15 @@ impl Tree {
let root_depth = root_path.components().collect::<Vec<_>>().len();
let mut stack = vec![root_path.to_owned()];
let mut nodes: HashMap<PathBuf, Node> = HashMap::new();
-
let mut last_path = root_path.to_owned();
+
while let Some(current_path) = stack.pop() {
let reached_depth = current_path.components().collect::<Vec<_>>().len();
if reached_depth >= depth + root_depth {
continue;
}
let children_will_be_added = depth + root_depth - reached_depth > 1;
- let mut node = Node::new(&current_path, None);
+ let mut current_node = Node::new(&current_path, None);
if current_path.is_dir() && !current_path.is_symlink() && children_will_be_added {
if let Some(mut files) =
files_collection(&current_path, users, show_hidden, filter_kind, true)
@@ -172,12 +172,12 @@ impl Tree {
sort_kind.sort(&mut files);
let children = Self::make_children_and_stack_them(&mut stack, &files);
if !children.is_empty() {
- node.set_children(Some(children));
+ current_node.set_children(Some(children));
}
};
}
- last_path = node.path.to_owned();
- nodes.insert(node.path.to_owned(), node);
+ last_path = current_path.to_owned();
+ nodes.insert(current_path.to_owned(), current_node);
}
let Some(root_node) = nodes.get_mut(&root_path) else {