separate tui model and view layers

This commit is contained in:
🪞👃🪞 2024-11-25 17:57:20 +01:00
parent 1060afa4f3
commit 416acd9f7b
19 changed files with 1124 additions and 1095 deletions

View file

@ -0,0 +1,24 @@
use crate::*;
impl Content for FileBrowser {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
Stack::down(|add|{
let mut i = 0;
for (_, name) in self.dirs.iter() {
if i >= self.scroll {
add(&TuiStyle::bold(name.as_str(), i == self.index))?;
}
i += 1;
}
for (_, name) in self.files.iter() {
if i >= self.scroll {
add(&TuiStyle::bold(name.as_str(), i == self.index))?;
}
i += 1;
}
add(&format!("{}/{i}", self.index))?;
Ok(())
})
}
}