commencing testing of alignments

This commit is contained in:
🪞👃🪞 2025-01-10 19:38:44 +01:00
parent ccd905d573
commit d58ac8de9a
2 changed files with 26 additions and 5 deletions

View file

@ -14,10 +14,11 @@ const EDN: &'static [&'static str] = &[
include_str!("edn08.edn"),
include_str!("edn09.edn"),
include_str!("edn10.edn"),
include_str!("edn11.edn"),
];
fn main () -> Usually<()> {
let state = Arc::new(RwLock::new(Example(4, Measure::new())));
let state = Arc::new(RwLock::new(Example(10, Measure::new())));
Tui::new().unwrap().run(&state)?;
Ok(())
}
@ -44,10 +45,13 @@ impl EdnViewData<TuiOut> for &Example {
impl Content<TuiOut> for Example {
fn content (&self) -> impl Render<TuiOut> {
let title = Tui::bg(Color::Rgb(60,10,10), Push::y(1, Align::n(format!("Example {}/{} in {:?}", self.0 + 1, EDN.len(), &self.1.wh()))));
let code = Tui::bg(Color::Rgb(10,60,10), Push::y(2, Align::n(format!("{}", EDN[self.0]))));
let content = Tui::bg(Color::Rgb(10,10,60), EdnView::from_source(self, EDN[self.0]));
self.1.of(Bsp::s(title, Bsp::n(code, content)))
let title = Tui::bg(Color::Rgb(60,10,10),
Push::y(1, Align::n(format!("Example {}/{} in {:?}", self.0 + 1, EDN.len(), &self.1.wh()))));
let code = Tui::bg(Color::Rgb(10,60,10),
Push::y(2, Align::n(format!("{}", EDN[self.0]))));
let content = Tui::bg(Color::Rgb(10,10,60),
EdnView::from_source(self, EDN[self.0]));
self.1.of(Bsp::s(title, Bsp::n(""/*code*/, content)))
}
}

17
tek/examples/edn11.edn Normal file
View file

@ -0,0 +1,17 @@
(bsp/s
(bsp/e
(align/nw (fixed/xy 5 3 :hello))
(bsp/e
(align/n (fixed/xy 5 3 :hello))
(align/ne (fixed/xy 5 3 :hello))))
(bsp/s
(bsp/e
(align/w (fixed/xy 5 3 :hello))
(bsp/e
(align/c (fixed/xy 5 3 :hello))
(align/e (fixed/xy 5 3 :hello))))
(bsp/e
(align/sw (fixed/xy 5 3 :hello))
(bsp/e
(align/s (fixed/xy 5 3 :hello))
(align/se (fixed/xy 5 3 :hello))))))