diff options
author | qkzk <qu3nt1n@gmail.com> | 2023-11-07 09:45:52 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2023-11-07 09:45:52 +0100 |
commit | 64b3564b51d359010fcd339d762290f08ee91dba (patch) | |
tree | 506b04f3f29decad59bcf90c5add7167593a7d2e | |
parent | 17b59cce5ecddf6f7c6609a5680f3486649932d6 (diff) |
don't use public attributes in nodes
-rw-r--r-- | src/fileinfo.rs | 2 | ||||
-rw-r--r-- | src/tree.rs | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/fileinfo.rs b/src/fileinfo.rs index 9821adf2..27ad61d2 100644 --- a/src/fileinfo.rs +++ b/src/fileinfo.rs @@ -581,7 +581,7 @@ impl ColorEffect { #[inline] pub fn node(fileinfo: &FileInfo, current_node: &Node) -> Self { let mut color_effect = Self::new(fileinfo); - if current_node.selected { + if current_node.selected() { color_effect.effect |= Effect::REVERSE; } color_effect diff --git a/src/tree.rs b/src/tree.rs index aee8312c..1c58f8db 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -38,10 +38,10 @@ impl ColoredString { #[derive(Debug, Clone)] pub struct Node { - pub path: PathBuf, - pub children: Option<Vec<PathBuf>>, - pub folded: bool, - pub selected: bool, + path: PathBuf, + children: Option<Vec<PathBuf>>, + folded: bool, + selected: bool, } impl Node { @@ -74,6 +74,10 @@ impl Node { self.selected = false } + pub fn selected(&self) -> bool { + self.selected + } + pub fn fileinfo(&self, users: &Users) -> Result<FileInfo> { FileInfo::new(&self.path, users) } |