From 1dcce2502f29c9f414abcc66ac948609e1faa44a Mon Sep 17 00:00:00 2001 From: unspeaker Date: Fri, 10 Jan 2025 19:23:00 +0100 Subject: [PATCH] fix text centering! --- tui/src/tui_content.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tui/src/tui_content.rs b/tui/src/tui_content.rs index 51cf7b3f..9a0ad1ad 100644 --- a/tui/src/tui_content.rs +++ b/tui/src/tui_content.rs @@ -5,7 +5,8 @@ impl Content for &str { to.center_xy([self.chars().count() as u16, 1]) } fn render (&self, to: &mut TuiOut) { - to.blit(self, to.area.x(), to.area.y(), None) + let [x, y, ..] = Content::layout(self, to.area()); + to.blit(self, x, y, None) } } @@ -14,7 +15,8 @@ impl Content for String { to.center_xy([self.chars().count() as u16, 1]) } fn render (&self, to: &mut TuiOut) { - to.blit(self, to.area.x(), to.area.y(), None) + let [x, y, ..] = Content::layout(self, to.area()); + to.blit(self, x, y, None) } }