From 070a780d7f7ca4ef03ab29898ec553933994bfab Mon Sep 17 00:00:00 2001 From: mo8it Date: Sun, 14 Apr 2024 16:04:05 +0200 Subject: [PATCH] Trim the final message --- src/app_state.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app_state.rs b/src/app_state.rs index fb4b92e..432a9a2 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -228,8 +228,12 @@ impl AppState { writer.execute(Clear(ClearType::All))?; writer.write_all(FENISH_LINE.as_bytes())?; - writer.write_all(self.final_message.as_bytes())?; - writer.write_all(b"\n")?; + + let final_message = self.final_message.trim(); + if !final_message.is_empty() { + writer.write_all(self.final_message.as_bytes())?; + writer.write_all(b"\n")?; + } return Ok(ExercisesProgress::AllDone); };