Auto merge of #227 - workingjubilee:watch-clears-terminal, r=fmoko
watch: clears terminal before entering loop Fixes #146 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. Note that the escape character is chosen for compatibility reasons, because different shells/terminals can change which commands they accept or have installed, betting on what other commands are in use to collect data seems risky, and just expecting them to implement ANSI escape code sequences is more reliable. This seems especially true since Windows is seeking more UNIX compatibility in its terminals going forward, even though it doesn't implement the POSIX standard per se.
This commit is contained in:
commit
fea81419cd
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user