From 9d32837669f0aef54a67fceee3bf7211b31ed98f Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 8 Mar 2023 21:34:20 +0800 Subject: chore: optimize newline again (#43) * chore: optimize newline again command mode: should no extra newline chat mode: should have one newline * fix windows newline * fix macos newline --- src/repl/handler.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/repl') diff --git a/src/repl/handler.rs b/src/repl/handler.rs index 5855208..22d8fd0 100644 --- a/src/repl/handler.rs +++ b/src/repl/handler.rs @@ -97,14 +97,20 @@ pub struct ReplyStreamHandler { sender: Option>, buffer: String, abort: SharedAbortSignal, + repl: bool, } impl ReplyStreamHandler { - pub fn new(sender: Option>, abort: SharedAbortSignal) -> Self { + pub fn new( + sender: Option>, + repl: bool, + abort: SharedAbortSignal, + ) -> Self { Self { sender, abort, buffer: String::new(), + repl, } } @@ -132,6 +138,12 @@ impl ReplyStreamHandler { if !self.buffer.ends_with('\n') { print_now!("\n") } + if self.repl { + print_now!("\n"); + if cfg!(macos) { + print_now!("\n") + } + } } } Ok(()) -- cgit v1.2.3