Skip to content

Conversation

@cgreening
Copy link
Contributor

Summary

Adds buttons for sending CTRL-C and CTRL-D

Motivation & Context

Closes #13

Changes

Adds buttons for sending these codes

Screenshots / Demos (if UI)

Screenshot 2025-10-01 at 22 40 12

How to Test

  1. Connect to serial
  2. Try the new buttons

Checklist

  • I ran npm run lint and fixed any issues
  • I ran npm run typecheck (TypeScript) with no errors
  • I ran npm test and tests pass
  • I ran npm run test:coverage if code paths changed significantly
  • I added/updated tests where appropriate
  • I updated docs/README if needed
  • No breaking changes without clear migration notes

Additional Notes

@cgreening cgreening requested a review from Copilot October 1, 2025 21:40
@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
web-serial-plotter 9428dab Commit Preview URL

Branch Preview URL
Oct 01 2025, 09:39 PM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for sending CTRL-C and CTRL-D control characters in the serial console interface. It introduces both keyboard shortcuts and dedicated UI buttons for these commonly used terminal control commands.

  • Adds keyboard shortcuts (Ctrl-C and Ctrl-D) that are intercepted and sent as control characters
  • Implements UI buttons for sending CTRL-C (interrupt) and CTRL-D (EOF) commands
  • Updates message handling logic to properly format and log control characters

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/components/SerialConsole.tsx Updates message handling to detect and properly format control characters without adding newlines
src/components/ConsoleInput.tsx Adds keyboard event handling, control character buttons, and updated placeholder text

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


// Log outgoing message with readable name for control chars
if (isControlChar) {
const code = message.charCodeAt(0)
Copy link

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The control character name generation logic uses a magic number (64) without explanation. Consider adding a comment explaining that this converts ASCII control codes to their corresponding caret notation (e.g., code 3 becomes '^C' via String.fromCharCode(64 + 3) = '@' + 3 = 'C').

Suggested change
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')

Copilot uses AI. Check for mistakes.
@cgreening cgreening merged commit ae73642 into main Oct 1, 2025
5 of 6 checks passed
@cgreening cgreening deleted the feature/ctrl-c-ctrl-d branch October 1, 2025 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Option to send Ctrl-C/Ctrl-D in Console

2 participants