From 01cf9d93e2672247d33046d96f7dd9ecf1f271be Mon Sep 17 00:00:00 2001 From: John Date: Tue, 18 Feb 2025 21:48:36 -0600 Subject: [PATCH] cl-repl: Usability improvements - Don't print empty - Don't needlessly append newline to cleared screen --- compiler/cl-repl/src/menu.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/cl-repl/src/menu.rs b/compiler/cl-repl/src/menu.rs index ec8d975..2501dcd 100644 --- a/compiler/cl-repl/src/menu.rs +++ b/compiler/cl-repl/src/menu.rs @@ -6,7 +6,7 @@ use cl_parser::Parser; use repline::{error::ReplResult, prebaked::*}; pub fn clear() { - println!("{}", ansi::CLEAR_ALL); + print!("{}", ansi::CLEAR_ALL); banner() } @@ -44,6 +44,9 @@ pub fn run(ctx: &mut ctx::Context) -> ReplResult<()> { use cl_parser::inliner::ModuleInliner; read_and(ansi::CYAN, "cl>", " ?>", |line| { + if line.trim().is_empty() { + return Ok(Response::Deny); + } let code = Parser::new(Lexer::new(line)).parse::()?; let code = ModuleInliner::new(".").fold_stmt(code);