mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
separate tui model and view layers
This commit is contained in:
parent
1060afa4f3
commit
416acd9f7b
19 changed files with 1124 additions and 1095 deletions
24
crates/tek_tui/src/tui_view_file_browser.rs
Normal file
24
crates/tek_tui/src/tui_view_file_browser.rs
Normal 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(())
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue