mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-25 00:00:05 +03:00
Push newline after running an exercise instead on each rendering
This commit is contained in:
parent
e7ba88f905
commit
a2d1cb3b22
|
@ -56,10 +56,12 @@ impl<'a> WatchState<'a> {
|
||||||
"\nChecking the exercise `{}`. Please wait…",
|
"\nChecking the exercise `{}`. Please wait…",
|
||||||
self.app_state.current_exercise().name,
|
self.app_state.current_exercise().name,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let success = self
|
let success = self
|
||||||
.app_state
|
.app_state
|
||||||
.current_exercise()
|
.current_exercise()
|
||||||
.run_exercise(Some(&mut self.output), self.app_state.cmd_runner())?;
|
.run_exercise(Some(&mut self.output), self.app_state.cmd_runner())?;
|
||||||
|
self.output.push(b'\n');
|
||||||
if success {
|
if success {
|
||||||
self.done_status =
|
self.done_status =
|
||||||
if let Some(solution_path) = self.app_state.current_solution_path()? {
|
if let Some(solution_path) = self.app_state.current_solution_path()? {
|
||||||
|
@ -121,11 +123,9 @@ impl<'a> WatchState<'a> {
|
||||||
pub fn render(&mut self) -> Result<()> {
|
pub fn render(&mut self) -> Result<()> {
|
||||||
// Prevent having the first line shifted if clearing wasn't successful.
|
// Prevent having the first line shifted if clearing wasn't successful.
|
||||||
self.writer.write_all(b"\n")?;
|
self.writer.write_all(b"\n")?;
|
||||||
|
|
||||||
clear_terminal(&mut self.writer)?;
|
clear_terminal(&mut self.writer)?;
|
||||||
|
|
||||||
self.writer.write_all(&self.output)?;
|
self.writer.write_all(&self.output)?;
|
||||||
self.writer.write_all(b"\n")?;
|
|
||||||
|
|
||||||
if self.show_hint {
|
if self.show_hint {
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|
Loading…
Reference in a new issue