This commit is contained in:
John Doty 2024-08-10 06:42:57 -07:00
parent e32f27494a
commit cc004df6e8
3 changed files with 8 additions and 10 deletions

View file

@ -476,15 +476,14 @@ impl UI {
ev: Option<Result<Event, std::io::Error>>,
) {
match ev {
Some(Ok(Event::Key(ev))) => match ev {
Some(Ok(Event::Key(
KeyEvent { code: KeyCode::Esc, .. }
| KeyEvent { code: KeyCode::Char('q'), .. }
| KeyEvent { code: KeyCode::Char('?'), .. }
| KeyEvent { code: KeyCode::Char('h'), .. } => {
| KeyEvent { code: KeyCode::Char('h'), .. },
))) => {
self.show_help = false;
}
_ => (),
},
Some(Ok(_)) => (), // Don't care about this event...
Some(Err(_)) => (), // Hmmmmmm.....?
None => (), // ....no events? what?

View file

@ -99,8 +99,7 @@ impl Message {
result.put_u16(port.port);
// Port descriptions can be long, let's make sure they're not.
let sliced =
slice_up_to(&port.desc, u16::max_value().into());
let sliced = slice_up_to(&port.desc, u16::MAX.into());
put_string(result, sliced);
}
}

View file

@ -114,7 +114,7 @@ mod tests {
use tokio::io::{AsyncReadExt, DuplexStream};
async fn sync(client_read: &mut DuplexStream) {
print!("[client] Waiting for server sync...\n");
println!("[client] Waiting for server sync...");
for _ in 0..8 {
let b = client_read
.read_u8()
@ -124,7 +124,7 @@ mod tests {
}
let mut reader = MessageReader::new(client_read);
print!("[client] Reading first message...\n");
println!("[client] Reading first message...");
let msg = reader.read().await.expect("Error reading first message");
assert_matches!(msg, Message::Hello(0, 2, _));
}