separate viewing/playing phrase + format

This commit is contained in:
🪞👃🪞 2024-10-03 21:41:14 +03:00
parent 6f91eb085d
commit ae60b792d6
4 changed files with 127 additions and 138 deletions

View file

@ -367,6 +367,18 @@ impl Widget for &str {
Ok(to.blit(&self, x, y, None))
}
}
impl Widget for String {
type Engine = Tui;
fn layout (&self, _: [u16;2]) -> Perhaps<[u16;2]> {
// TODO: line breaks
Ok(Some([self.chars().count() as u16, 1]))
}
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
let [x, y, ..] = to.area();
//let [w, h] = self.layout(to.area().wh())?.unwrap();
Ok(to.blit(&self, x, y, None))
}
}
impl<T: Widget<Engine = Tui>> Widget for DebugOverlay<Tui, T> {
type Engine = Tui;