mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 15:56:57 +02:00
refactor: move some things with their appropriate verticals
This commit is contained in:
parent
3b1c31c78d
commit
51faa82d74
9 changed files with 197 additions and 218 deletions
|
|
@ -1,5 +1,26 @@
|
|||
use crate::*;
|
||||
|
||||
/// The [Draw] implementation for [App] handles the loaded view,
|
||||
/// which is defined in terms of [dizzle] DSL.
|
||||
///
|
||||
/// If there is an error, the error is displayed. FIXME: overlay it
|
||||
/// Then, every top-level form of the DSL description is rendered.
|
||||
impl Draw<Tui> for App {
|
||||
fn draw (self, to: &mut Tui) -> Usually<XYWH<u16>> {
|
||||
let xywh = to.area().into();
|
||||
if let Some(e) = self.error.read().unwrap().as_ref() {
|
||||
to.show(xywh, e.as_ref())?;
|
||||
}
|
||||
for (index, dsl) in self.mode.view.iter().enumerate() {
|
||||
if let Err(e) = self.interpret(to, dsl) {
|
||||
*self.error.write().unwrap() = Some(format!("view #{index}: {e}").into());
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(xywh)
|
||||
}
|
||||
}
|
||||
|
||||
impl Interpret<Tui, XYWH<u16>> for App {
|
||||
fn interpret_expr <'a> (&'a self, to: &mut Tui, lang: &'a impl Expression)
|
||||
-> Usually<XYWH<u16>>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue