From 1f541407597c7866cf1450d03967ab4711d28d29 Mon Sep 17 00:00:00 2001 From: facile pop culture reference Date: Wed, 12 Aug 2026 11:22:12 +0300 Subject: [PATCH 1/3] remove generic from Namespace --- dizzle | 2 +- src/layout.rs | 14 +++++++------- src/term/modify.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dizzle b/dizzle index 5426dc4..ab177b0 160000 --- a/dizzle +++ b/dizzle @@ -1 +1 @@ -Subproject commit 5426dc44f231531758a7e8575117357b55b1a9f5 +Subproject commit ab177b0d0d1ccdff0c69f915847be9a23a364663 diff --git a/src/layout.rs b/src/layout.rs index 108f013..09755a1 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -163,9 +163,9 @@ impl Sizer { $state: &S, $output: &mut O, $expr: &str ) -> Perhaps> where S: Interpret>> - + for<'b> Namespace<'b, bool> - + for<'b> Namespace<'b, O::Unit> - + for<'b> Namespace<'b, Option> + + Namespace + + Namespace + + Namespace> $body } } @@ -177,10 +177,10 @@ impl Sizer { $state: &S, $output: &mut Tui, $expr: &str ) -> Perhaps> where S: Interpret>> - + for<'b> Namespace<'b, bool> - + for<'b> Namespace<'b, u16> - + for<'b> Namespace<'b, Option> - + for<'b> Namespace<'b, Color> + + Namespace + + Namespace + + Namespace> + + Namespace $body } } diff --git a/src/term/modify.rs b/src/term/modify.rs index 118aeb7..9542452 100644 --- a/src/term/modify.rs +++ b/src/term/modify.rs @@ -30,7 +30,7 @@ fn_kw_layout_tui!(kw_tui_bg |state, output, expr| { }); impl Tui { - pub fn eval_color_expr (state: &impl for<'a> Namespace<'a, u8>, src: impl Language) + pub fn eval_color_expr (state: &impl Namespace, src: impl Language) -> Perhaps { if let Some(expr) = src.expr()? { From 3ee25879cd7a56df3366ac31a7ff3c5d2873d5e8 Mon Sep 17 00:00:00 2001 From: facile pop culture reference Date: Thu, 13 Aug 2026 07:43:25 +0300 Subject: [PATCH 2/3] safe subtract in border --- src/term/border.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/term/border.rs b/src/term/border.rs index f09a46a..1edbc5a 100644 --- a/src/term/border.rs +++ b/src/term/border.rs @@ -194,7 +194,7 @@ pub trait BorderStyle: Draw + Copy { let area = to.area(); let style = style.or_else(||self.style_vertical()); let [x, x2, y, y2] = area.lrtb(); - let h = y2 - y; + let h = y2.minus(y); if h > 1 { for y in y..y2.saturating_sub(1) { to.blit(&Self::W, x, y, style); From 95ace837565c65292d86694cb395d9ba7fa834eb Mon Sep 17 00:00:00 2001 From: facile pop culture reference Date: Thu, 13 Aug 2026 07:43:42 +0300 Subject: [PATCH 3/3] implement Draw for usize --- src/term.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/term.rs b/src/term.rs index e9060b1..d41a823 100644 --- a/src/term.rs +++ b/src/term.rs @@ -439,6 +439,28 @@ impl> Draw for ShowSizeOf { } } + 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) });