From 83be517e77a87b8de7a24c98f38ae10412d02aec Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 9 Nov 2019 23:52:30 -0800 Subject: [PATCH] watch: clears terminal before entering loop If someone is sliding in and out of "watch" mode, it can make it hard to tell which error messages are still relevant. This patch resolves that by clearing the terminal entirely before entering watch's loop. --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 78ed060..857d34e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,6 +80,9 @@ fn main() { } if matches.subcommand_matches("watch").is_some() { + /* Clears the terminal with an ANSI escape code. + Works in UNIX and newer Windows terminals. */ + println!("\x1Bc"); watch(&exercises).unwrap(); }