feat: add custom key mapping system#118
Conversation
iTerm2-style key remapping: users define key combos and what the terminal sends when pressed (ignore, escape sequence, hex code, or text). Also fixes a bug where xterm.js only supports one attachCustomKeyEventHandler but the codebase registered two (Shift+Enter and macOS Option key), with the second silently overwriting the first. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix #isDisposed being set to false instead of true in MacOSOptionKeyPassthroughAddon.dispose(). Also use Settings.KeyMapping directly instead of a duplicate local interface, and simplify formatShortcut with filter+join. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds an iTerm2-style preset to the key mapping modal that maps common macOS text navigation shortcuts (Option/Cmd + arrows, backspace, delete). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hey! Just bumping this, wondering if it might get a review at some point? Happy to make any revisions needed. I've been using this feature daily in my own setup and it's been working well, I think custom key mappings would be a nice addition to the plugin. |
|
Hey @ryanbbrown, thanks for taking the time to contribute this PR. Let me go through each point:
This was already fixed on
Four of the seven bindings in the preset are already shipped on That said, I don't think these seven key mappings should be a loadable preset. Every macOS terminal user expects
The concept is genuinely useful for user-defined bindings beyond the standard set, but I think it needs its own follow-up issue/PR. A few things need to be considered first:
This would also require an architectural decision: one suggestions could be one key-event router with a priority pipeline ( What I’d suggest for this PR is rebasing onto current For the user-configurable mapping system, I suggest you open an issue or a follow up PR. Let me know if you have questions, we can discuss further. |
Summary
attachCustomKeyEventHandlercalls silently overwrote each other (Shift+Enter handler was lost by the macOS Option key handler). All key interception is now consolidated into a singleKeyMappingAddon.Key mapping preset: Natural Text Editing
🤖 Generated with Claude Code