Compare commits

..

No commits in common. "95ace837565c65292d86694cb395d9ba7fa834eb" and "b7f4d55e1d67d3481ecee14f693ca3e0a9426a6c" have entirely different histories.

5 changed files with 10 additions and 32 deletions

2
dizzle

@ -1 +1 @@
Subproject commit ab177b0d0d1ccdff0c69f915847be9a23a364663
Subproject commit 5426dc44f231531758a7e8575117357b55b1a9f5

View file

@ -163,9 +163,9 @@ impl Sizer {
$state: &S, $output: &mut O, $expr: &str
) -> Perhaps<XYWH<O::Unit>> where
S: Interpret<O, Option<XYWH<O::Unit>>>
+ Namespace<bool>
+ Namespace<O::Unit>
+ Namespace<Option<O::Unit>>
+ for<'b> Namespace<'b, bool>
+ for<'b> Namespace<'b, O::Unit>
+ for<'b> Namespace<'b, Option<O::Unit>>
$body
}
}
@ -177,10 +177,10 @@ impl Sizer {
$state: &S, $output: &mut Tui, $expr: &str
) -> Perhaps<XYWH<u16>> where
S: Interpret<Tui, Option<XYWH<u16>>>
+ Namespace<bool>
+ Namespace<u16>
+ Namespace<Option<u16>>
+ Namespace<Color>
+ for<'b> Namespace<'b, bool>
+ for<'b> Namespace<'b, u16>
+ for<'b> Namespace<'b, Option<u16>>
+ for<'b> Namespace<'b, Color>
$body
}
}

View file

@ -439,28 +439,6 @@ impl<T: Draw<Tui>> Draw<Tui> for ShowSizeOf<T> {
}
}
impl_draw!(|self: usize, to: Tui|{
let XYWH(x0, y0, w0, h0) = to.area();
let mut v = *self;
let w = (1 + if v > 0 { self.ilog10() } else { 0 }) as u16;
let h = 1u16;
Ok((w0 >= w && h0 >= h).then(||{
if let Tui::Draw(buffer, ..) = to {
let mut x = x0 + w - 1;
while x >= x0 {
if let Some(cell) = buffer.cell_mut(Position { x, y: y0 }) {
cell.set_char([
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
][(v % 10) as usize]);
}
x -= 1;
v = v / 10;
}
}
XYWH(x0, y0, w, h)
}))
});
impl_draw!(|self: String, to: Tui|{
self.as_str().draw(to)
});

View file

@ -194,7 +194,7 @@ pub trait BorderStyle: Draw<Tui> + Copy {
let area = to.area();
let style = style.or_else(||self.style_vertical());
let [x, x2, y, y2] = area.lrtb();
let h = y2.minus(y);
let h = y2 - y;
if h > 1 {
for y in y..y2.saturating_sub(1) {
to.blit(&Self::W, x, y, style);

View file

@ -30,7 +30,7 @@ fn_kw_layout_tui!(kw_tui_bg |state, output, expr| {
});
impl Tui {
pub fn eval_color_expr (state: &impl Namespace<u8>, src: impl Language)
pub fn eval_color_expr (state: &impl for<'a> Namespace<'a, u8>, src: impl Language)
-> Perhaps<Color>
{
if let Some(expr) = src.expr()? {