Show the invalid command to avoid confusion after resizing the terminal

This commit is contained in:
mo8it
2024-04-10 04:08:40 +02:00
parent a46d66134b
commit 6255efe8b2
2 changed files with 17 additions and 16 deletions
+7 -2
View File
@@ -159,8 +159,13 @@ You can keep working on this exercise or jump into the next one by removing the
self.show_prompt()
}
pub fn handle_invalid_cmd(&mut self) -> io::Result<()> {
self.writer.write_all(b"Invalid command")?;
pub fn handle_invalid_cmd(&mut self, cmd: &str) -> io::Result<()> {
self.writer.write_all(b"Invalid command: ")?;
self.writer.write_all(cmd.as_bytes())?;
if cmd.len() > 1 {
self.writer
.write_all(b" (confusing input can occur after resizing the terminal)")?;
}
self.show_prompt()
}
}