diff --git a/output/src/ops/map.rs b/output/src/ops/map.rs index 0f75c82..5dbc92b 100644 --- a/output/src/ops/map.rs +++ b/output/src/ops/map.rs @@ -62,9 +62,9 @@ where get_item: impl Fn(A, usize)->B + Send + Sync ) -> Map< E, A, - Push>>>, + Push>>, I, F, - impl Fn(A, usize)->Push>>> + Send + Sync + impl Fn(A, usize)->Push>> + Send + Sync > { Map { __: PhantomData, @@ -75,7 +75,7 @@ where for i in 0..index { push = push + size; } - Push::x(push, Align::w(Fixed::x(size, Fill::y(get_item(item, index))))) + Push::x(push, Align::w(Fixed::x(size, get_item(item, index)))) } } } @@ -86,9 +86,9 @@ where get_item: impl Fn(A, usize)->B + Send + Sync ) -> Map< E, A, - Push>>, + Push>>, I, F, - impl Fn(A, usize)->Push>> + Send + Sync + impl Fn(A, usize)->Push>> + Send + Sync > where E: Output, B: Render, @@ -104,7 +104,7 @@ where for i in 0..index { push = push + size; } - Push::y(push, Fixed::y(size, Fill::x(get_item(item, index)))) + Push::y(push, Align::n(Fixed::y(size, get_item(item, index)))) } } } diff --git a/tui/examples/edn14.edn b/tui/examples/edn14.edn new file mode 100644 index 0000000..7aab387 --- /dev/null +++ b/tui/examples/edn14.edn @@ -0,0 +1 @@ +:map-e diff --git a/tui/examples/edn15.edn b/tui/examples/edn15.edn new file mode 100644 index 0000000..ddd4d58 --- /dev/null +++ b/tui/examples/edn15.edn @@ -0,0 +1 @@ +(align/c :map-e) diff --git a/tui/examples/edn16.edn b/tui/examples/edn16.edn new file mode 100644 index 0000000..9c6b9ad --- /dev/null +++ b/tui/examples/edn16.edn @@ -0,0 +1 @@ +:map-s diff --git a/tui/examples/edn17.edn b/tui/examples/edn17.edn new file mode 100644 index 0000000..efd092f --- /dev/null +++ b/tui/examples/edn17.edn @@ -0,0 +1 @@ +(align/c :map-s) diff --git a/tui/examples/tui.rs b/tui/examples/tui.rs index f737fb3..7d9f9d7 100644 --- a/tui/examples/tui.rs +++ b/tui/examples/tui.rs @@ -25,7 +25,11 @@ const EXAMPLES: &'static [&'static str] = &[ include_str!("edn10.edn"), include_str!("edn11.edn"), include_str!("edn12.edn"), - include_str!("edn13.edn"), + //include_str!("edn13.edn"), + include_str!("edn14.edn"), + include_str!("edn15.edn"), + include_str!("edn16.edn"), + include_str!("edn17.edn"), ]; handle!(TuiIn: |self: Example, input|{ @@ -58,7 +62,7 @@ atom_command!(ExampleCommand: |app: Example| { view!(TuiOut: |self: Example|{ let index = self.0 + 1; let wh = self.1.wh(); - let src = EXAMPLES[self.0]; + let src = EXAMPLES.get(self.0).unwrap_or(&""); let heading = format!("Example {}/{} in {:?}", index, EXAMPLES.len(), &wh); let title = Tui::bg(Color::Rgb(60, 10, 10), Push::y(1, Align::n(heading))); let code = Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", src)))); @@ -69,7 +73,9 @@ view!(TuiOut: |self: Example|{ ":code" => Tui::bg(Color::Rgb(10, 60, 10), Push::y(2, Align::n(format!("{}", EXAMPLES[self.0])))).boxed(), ":hello" => Tui::bg(Color::Rgb(10, 100, 10), "Hello").boxed(), ":world" => Tui::bg(Color::Rgb(100, 10, 10), "world").boxed(), - ":hello-world" => "Hello world!".boxed() + ":hello-world" => "Hello world!".boxed(), + ":map-e" => Map::east(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(), + ":map-s" => Map::south(5u16, ||0..5u16, |n, i|format!("{n}")).boxed(), }); expose! {