-
-
Notifications
You must be signed in to change notification settings - Fork 19
Allow sending of CTRL-C and CTRL-D #19
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,11 +17,20 @@ export default function SerialConsole({ isConnected, onSendMessage }: SerialCons | |||||||
|
|
||||||||
| const handleSendMessage = useCallback(async (message: string) => { | ||||||||
| try { | ||||||||
| // Add newline to message if not present | ||||||||
| const messageToSend = message.endsWith('\n') ? message : message + '\n' | ||||||||
| // Check if message is a control character (ASCII 0-31) | ||||||||
| const isControlChar = message.length === 1 && message.charCodeAt(0) < 32 | ||||||||
|
|
||||||||
| // Log outgoing message | ||||||||
| addOutgoing(message) | ||||||||
| // Add newline to message if not present (unless it's a control character) | ||||||||
| const messageToSend = isControlChar ? message : (message.endsWith('\n') ? message : message + '\n') | ||||||||
|
|
||||||||
| // Log outgoing message with readable name for control chars | ||||||||
| if (isControlChar) { | ||||||||
| const code = message.charCodeAt(0) | ||||||||
|
||||||||
| const code = message.charCodeAt(0) | |
| const code = message.charCodeAt(0) | |
| // The magic number 64 converts ASCII control codes to caret notation (e.g., code 3 becomes '^C' via String.fromCharCode(64 + 3) = 'C') |
Uh oh!
There was an error while loading. Please reload this page.