mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-07-17 15:56:57 +02:00
add origin and align methods to Layout trait
This commit is contained in:
parent
09463649c6
commit
13c886d9e0
18 changed files with 333 additions and 248 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use ::{
|
||||
std::{io::stdout, sync::{Arc, RwLock}},
|
||||
tengri::{*, term::*, lang::*, keys::*, draw::*, space::*, lang::*},
|
||||
ratatui::style::Color,
|
||||
tengri::{*, lang::*},
|
||||
};
|
||||
|
||||
tui_main!(State {
|
||||
|
|
@ -18,10 +18,10 @@ tui_view!(|self: State| {
|
|||
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 title = bg(Color::Rgb(60, 10, 10), heading.align_n().push_y(1));
|
||||
let code = bg(Color::Rgb(10, 60, 10), format!("{}", src).align_n().push_y(2));
|
||||
//let content = ;//();//bg(Color::Rgb(10, 10, 60), View(self, CstIter::new(src)));
|
||||
let widget = thunk(move|to: &mut Tui|self.interpret(to, &src));
|
||||
let widget = thunk(move|to: &mut Tui|self.interpret(to, &src).map(Some));
|
||||
self.size.of(south(title, north(code, widget)))
|
||||
});
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ struct State {
|
|||
/** User-controllable value. */
|
||||
cursor: usize,
|
||||
/** Rendered window size. */
|
||||
size: crate::space::Size,
|
||||
size: Sizer,
|
||||
}
|
||||
|
||||
impl Interpret<Tui, XYWH<u16>> for State {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue