use crate::*; use ratatui::{prelude::{Style, Position, Backend, Color}}; pub const fn x_repeat (c: &str) -> impl Draw { thunk(move|to: &mut Tui|{ let XYWH(x, y, w, _h) = to.xywh(); for x in x..x+w { if let Some(cell) = to.0.cell_mut(Position::from((x, y))) { cell.set_symbol(&c); } } Ok(Some(XYWH(x, y, w, 1))) }) } pub const fn y_repeat (c: &str) -> impl Draw { thunk(move|to: &mut Tui|{ let XYWH(x, y, _w, h) = to.xywh(); for y in y..y+h { if let Some(cell) = to.0.cell_mut(Position::from((x, y))) { cell.set_symbol(&c); } } Ok(Some(XYWH(x, y, 1, h))) }) } pub const fn xy_repeat (c: &str) -> impl Draw { thunk(move|to: &mut Tui|{ let XYWH(x, y, w, h) = to.xywh(); let a = c.len(); for (_v, y) in (y..y+h).enumerate() { for (u, x) in (x..x+w).enumerate() { if let Some(cell) = to.0.cell_mut(Position::from((x, y))) { let u = u % a; cell.set_symbol(&c[u..u+1]); } } } Ok(Some(XYWH(x, y, w, h))) }) }