Skip to content

Commit 833e6e0

Browse files
committed
Newline after resetting attributes
1 parent 159273e commit 833e6e0

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/exercise.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ fn run_bin(
3131
) -> Result<bool> {
3232
if let Some(output) = output.as_deref_mut() {
3333
write_ansi(output, SetAttribute(Attribute::Underlined));
34-
output.extend_from_slice(b"Output\n");
34+
output.extend_from_slice(b"Output");
3535
write_ansi(output, ResetColor);
36+
output.push(b'\n');
3637
}
3738

3839
let success = cmd_runner.run_debug_bin(bin_name, output.as_deref_mut())?;
@@ -44,8 +45,9 @@ fn run_bin(
4445
// leaves the user confused about why the exercise isn't done yet.
4546
write_ansi(output, SetAttribute(Attribute::Bold));
4647
write_ansi(output, SetForegroundColor(Color::Red));
47-
output.extend_from_slice(b"The exercise didn't run successfully (nonzero exit code)\n");
48+
output.extend_from_slice(b"The exercise didn't run successfully (nonzero exit code)");
4849
write_ansi(output, ResetColor);
50+
output.push(b'\n');
4951
}
5052
}
5153

src/init.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,11 @@ pub fn init() -> Result<()> {
148148
}
149149

150150
stdout.queue(SetForegroundColor(Color::Green))?;
151-
stdout.write_all("Initialization done ✓\n\n".as_bytes())?;
152-
stdout
153-
.queue(ResetColor)?
154-
.queue(SetAttribute(Attribute::Bold))?;
151+
stdout.write_all("Initialization done ✓".as_bytes())?;
152+
stdout.queue(ResetColor)?;
153+
stdout.write_all(b"\n\n")?;
154+
155+
stdout.queue(SetAttribute(Attribute::Bold))?;
155156
stdout.write_all(POST_INIT_MSG)?;
156157
stdout.queue(ResetColor)?;
157158

src/watch/state.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ impl<'a> WatchState<'a> {
149149
Attributes::from(Attribute::Bold).with(Attribute::Underlined),
150150
))?
151151
.queue(SetForegroundColor(Color::Cyan))?;
152-
stdout.write_all(b"Hint\n")?;
152+
stdout.write_all(b"Hint")?;
153153
stdout.queue(ResetColor)?;
154+
stdout.write_all(b"\n")?;
154155

155156
stdout.write_all(self.app_state.current_exercise().hint.as_bytes())?;
156157
stdout.write_all(b"\n\n")?;
@@ -160,16 +161,17 @@ impl<'a> WatchState<'a> {
160161
stdout
161162
.queue(SetAttribute(Attribute::Bold))?
162163
.queue(SetForegroundColor(Color::Green))?;
163-
stdout.write_all("Exercise done ✓\n".as_bytes())?;
164+
stdout.write_all("Exercise done ✓".as_bytes())?;
164165
stdout.queue(ResetColor)?;
166+
stdout.write_all(b"\n")?;
165167

166168
if let DoneStatus::DoneWithSolution(solution_path) = &self.done_status {
167169
solution_link_line(stdout, solution_path)?;
168170
}
169171

170-
writeln!(
171-
stdout,
172-
"When done experimenting, enter `n` to move on to the next exercise 🦀\n",
172+
stdout.write_all(
173+
"When done experimenting, enter `n` to move on to the next exercise 🦀\n\n"
174+
.as_bytes(),
173175
)?;
174176
}
175177

0 commit comments

Comments
 (0)