From 2ca419bfd413f74b66dbbf6ae47baf1d70604095 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 1 Feb 2026 16:37:07 +0100 Subject: [PATCH] Fixed newline drawing in engine --- src/engine/console.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine/console.rs b/src/engine/console.rs index 236ee41..b3ad971 100644 --- a/src/engine/console.rs +++ b/src/engine/console.rs @@ -26,7 +26,7 @@ pub struct ConsoleExecutor { } /// Console-based rendering engine -/// +/// /// Renders components to the terminal using crossterm for cross-platform support. pub struct Console { /// Thread functions to execute @@ -64,8 +64,10 @@ impl Engine for Console { match inst { crate::render::DrawInstruction::Text(point, text) => { let (x, y) = (ctx.area.x + point.x, ctx.area.y + point.y); - execute!(stdout(), MoveTo(x, y),).unwrap(); - print!("{text}"); + for (i, line) in text.lines().enumerate() { + execute!(stdout(), MoveTo(x, y + (i as u16))).unwrap(); + print!("{line}"); + } stdout().flush().unwrap(); } crate::render::DrawInstruction::Child(_point, child) => self.draw_context(child),