Skip to content

Conversation

@ThalesMMS
Copy link

@ThalesMMS ThalesMMS commented Jan 11, 2026

Summary

  • Add Esc and Del buttons to the terminal keyboard toolbar.
  • Add Ctrl/Alt modifier toggles with active-state UI and generation tracking.
  • Apply modifier logic to terminal input (single chars, CSI/SS3 sequences) in the JS terminal layer.
  • Sync modifier resets between JS and Swift via notifications; reset modifiers after input or blur.

Changes

Terminal keyboard toolbar (TerminalKeyboardToolbar.swift):

  • Add controlActive/altActive state plus generation counters.
  • Add helpers to send input or cursor moves and then reset modifier state, plus a dedicated reset function.
  • Insert Esc, Ctrl, Alt, and Del buttons with accessibility labels and active-state highlighting for modifiers.
  • Route paste/tab/arrow actions through the modifier-reset helpers; reset modifiers on blur.
  • Listen for terminalControlReset/terminalAltReset notifications to clear the UI state when JS resets.

Terminal JavaScript (terminal.bundle/index.html):

  • Track modifier state and generation, expose setControlActive/setAltActive.
  • Apply Control/Alt to input, including CSI/SS3 sequences, and avoid applying modifiers to non-modifiable sequences.
  • Reset modifier state after use and notify Swift with generation-aware reset events.
  • Apply modifier processing inside term.onData before posting input to Swift.

Terminal instance (TerminalInstance.swift):

  • Handle ControlReset/AltReset messages from JS and post notifications with generation info.
  • Add methods to set Control/Alt state in the JS runtime.
  • Add terminalControlReset/terminalAltReset notification names.

Copilot AI review requested due to automatic review settings January 11, 2026 19:36
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 Esc and Ctrl key buttons to the terminal keyboard toolbar, enhancing terminal control capabilities on mobile devices. The Ctrl key features a toggle state with visual feedback and automatically resets after key presses.

Changes:

  • Added Esc button to send escape character to terminal
  • Added Ctrl button with toggle behavior and visual state
  • Implemented control character encoding (Ctrl+key combinations)

Reviewed changes

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

File Description
Dependencies/terminal.bundle/index.html Added JavaScript functions for control state management and control character encoding
CodeApp/Views/TerminalKeyboardToolbar.swift Added UI buttons for Esc and Ctrl keys with state management and notification handling
CodeApp/Managers/TerminalInstance.swift Added Swift methods to sync control state with JavaScript and handle control reset events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ThalesMMS ThalesMMS force-pushed the Terminal-Keyboard-Ctrl-Esc branch 2 times, most recently from bb5d156 to 72b4b0b Compare January 11, 2026 20:07
@ThalesMMS ThalesMMS requested a review from Copilot January 11, 2026 20:10
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Introduces Escape, Delete, and Control and Alt modifier buttons to the terminal keyboard toolbar, allowing users to send modified key sequences. Updates the Swift and JavaScript code to track modifier state, apply modifiers to terminal input, and synchronize state between the UI and the terminal. Modifier states are reset after use, and notifications are used to keep the UI in sync.
@ThalesMMS ThalesMMS force-pushed the Terminal-Keyboard-Ctrl-Esc branch from 1a388b8 to 10bd8c5 Compare January 11, 2026 20:42
@ThalesMMS ThalesMMS requested a review from Copilot January 11, 2026 20:43
@ThalesMMS ThalesMMS changed the title Add Esc and Ctrl keys to terminal keyboard toolbar Add Esc/Del and Ctrl/Alt modifier support to terminal toolbar Jan 11, 2026
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Added a check to exclude ESC[200~ and ESC[201~ keycodes from being modified, preserving the integrity of the bracketed paste protocol in the terminal.
@bummoblizard
Copy link
Member

Thank you! I will review the changes in a bit

@ThalesMMS
Copy link
Author

Thank you! I will review the changes in a bit

Please let me know if you think it needs changes.

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.

2 participants