Skip to content

examples: smux handle control characters #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions examples/smux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,15 @@ async fn handle_pane_key_event(pane: &mut PtyPane, key: &KeyEvent) -> bool {
// Close the pane
return false;
}
'l' => {
send = vec![27, 91, 50, 74];
_ => {
let char = ch.to_ascii_uppercase();
let ascii_val = char as u8;
// Since char is guaranteed to be an ASCII character,
// we can safely subtract 64 to get
// the corresponding control character
let ascii_to_send = ascii_val - 64;
send = vec![ascii_to_send];
}

_ => {}
}
}
send
Expand Down