diff options
| author | mo8it <mo8it@proton.me> | 2024-04-10 04:08:40 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-04-10 04:08:40 +0200 |
| commit | 6255efe8b2de9d8d7f69871584444ab34fae122d (patch) | |
| tree | 88fa3dffeef5c7b1829b58f358bddb9e09665acd /src/watch | |
| parent | a46d66134b26095e553f284c02de9a895e15f180 (diff) | |
Show the invalid command to avoid confusion after resizing the terminal
Diffstat (limited to 'src/watch')
| -rw-r--r-- | src/watch/state.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/watch/state.rs b/src/watch/state.rs index 08707a4..751285f 100644 --- a/src/watch/state.rs +++ b/src/watch/state.rs @@ -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() } } |
