feat: Adding toggle (#8)

* feat: Adding toggle

* Update src/lib.rs

Return unneded

Co-authored-by: EdJoPaTo <github@edjopato.de>

Co-authored-by: EdJoPaTo <github@edjopato.de>
This commit is contained in:
Nicholas Roller
2022-02-06 15:13:29 -05:00
committed by GitHub
parent c50c0329d9
commit 7ff37c6227
3 changed files with 17 additions and 0 deletions
+3
View File
@@ -82,6 +82,9 @@ fn main() -> Result<(), Box<dyn Error>> {
Key::Right => {
app.tree.open();
}
Key::Char('\n') => {
app.tree.toggle();
}
Key::Down => {
app.tree.next();
}
+4
View File
@@ -60,4 +60,8 @@ impl<'a> StatefulTree<'a> {
pub fn open(&mut self) {
self.state.open(self.state.selected());
}
pub fn toggle(&mut self) {
self.state.toggle();
}
}