-
Notifications
You must be signed in to change notification settings - Fork 308
Add Esc/Del and Ctrl/Alt modifier support to terminal toolbar #1300
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
Add Esc/Del and Ctrl/Alt modifier support to terminal toolbar #1300
Conversation
There was a problem hiding this 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.
bb5d156 to
72b4b0b
Compare
There was a problem hiding this 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.
1a388b8 to
10bd8c5
Compare
There was a problem hiding this 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.
|
Thank you! I will review the changes in a bit |
|
Hello! Any update? 😊 |
|
Yes. I noticed the esc / control button stays on but it only takes effect once. Should it be disabled after typing any character? Alternatively, the effect should be staying |
TerminalInstance now handles 'ControlReset' and 'AltReset' events, posting notifications with generation info. Also refactored cursor movement to use inputWithModifiers, with corresponding helper added in terminal.bundle/index.html.
Yes, as it is also the default behaviour of the iPad Shift key. Actually, the issue was that although it should be disabled after typing any character, the UI showed the key as still enabled. I just fixed that in this last commit. |
Replaces the call to term.input with inputWithModifiers in the type(text:) method to handle input with modifier keys. This may improve support for complex input scenarios in the terminal. Add lock functionality for Ctrl and Alt modifiers in terminal Introduces the ability to lock the Control and Alt modifier keys in the terminal keyboard toolbar via double-tap, with visual feedback and state management. Updates Swift and JavaScript code to support locked states, ensuring modifiers remain active until explicitly unlocked, and modifies reset logic to respect locked states.
|
Following your suggestion, I also added a “double-click Ctrl/Alt” option to lock the key, better imitating the Shift key’s default behavior. |
|
Thank you! It works very well during SSH sessions. A TestFlight build will be ready for people to test on soon. |
Summary
Changes
Terminal keyboard toolbar (TerminalKeyboardToolbar.swift):
Terminal JavaScript (terminal.bundle/index.html):
Terminal instance (TerminalInstance.swift):