example 00 compiles again
Some checks failed
/ build (push) Has been cancelled

and exits, weirdly. wonder what's up here
This commit is contained in:
i do not exist 2026-04-23 20:36:12 +03:00
parent b0fb9f013d
commit b44dc02f33
9 changed files with 110 additions and 80 deletions

View file

@ -1,31 +1,32 @@
use ::{
std::{io::stdout, sync::{Arc, RwLock}},
tengri::{*, term::*, lang::*, keys::*, draw::*, space::*},
tengri::{*, term::*, lang::*, keys::*, draw::*, space::*, dizzle::*},
ratatui::style::Color,
};
tui_main!(State { cursor: 10, ..Default::default() });
tui_main!(State {
cursor: 10,
..Default::default()
});
impl Apply<TuiEvent, Usually<Self>> for State {
fn apply (&mut self, input: &TuiEvent) -> Usually<Self> {
todo!()
}
}
tui_keys!(|self: State, input| {
todo!()
});
impl View<Tui> for State {
fn view (&self) -> impl Draw<Tui> {
let index = self.cursor + 1;
let wh = (self.size.w(), self.size.h());
let src = VIEWS.get(self.cursor).unwrap_or(&"");
let heading = format!("State {}/{} in {:?}", index, VIEWS.len(), &wh);
let title = bg(Color::Rgb(60, 10, 10), push_y(1, align_n(heading)));
let code = bg(Color::Rgb(10, 60, 10), push_y(2, align_n(format!("{}", src))));
//let content = ;//();//bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
self.size.of(bsp_s(title, bsp_n(code, self.understand(to, &src).unwrap())))
}
}
tui_view!(|self: State| {
let index = self.cursor + 1;
let wh = (self.size.w(), self.size.h());
let src = VIEWS.get(self.cursor).unwrap_or(&"");
let heading = format!("State {}/{} in {:?}", index, VIEWS.len(), &wh);
let title = bg(Color::Rgb(60, 10, 10), y_push(1, align_n(heading)));
let code = bg(Color::Rgb(10, 60, 10), y_push(2, align_n(format!("{}", src))));
//let content = ;//();//bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
let widget = thunk(move|to: &mut Tui|self.interpret(to, &src));
self.size.of(south(title, north(code, widget)))
});
#[derive(Debug, Default)] struct State {
#[derive(Debug, Default)]
struct State {
/** Command history (undo/redo). */
history: Vec<Action>,
/** User-controllable value. */
@ -34,7 +35,9 @@ impl View<Tui> for State {
size: crate::space::Size,
}
//impl_from!(Action: |input: &TuiIn| todo!());
impl Interpret<Tui, XYWH<u16>> for State {
}
#[derive(Debug)] enum Action {
/** Increment cursor */
Next,
@ -42,6 +45,8 @@ impl View<Tui> for State {
Prev
}
//impl_from!(Action: |input: &TuiIn| todo!());
fn draw_example (state: &State, to: &mut Tui) {
}