-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Additional alt and control sequences #1231
Conversation
* Add punctuation alt sequences * Add support for ctrl+alt sequences
src/Terminal.ts
Outdated
} else if (ev.keyCode >= 48 && ev.keyCode <= 57) { | ||
result.key = C0.ESC + (ev.keyCode - 48); | ||
} else { | ||
const t = (p,s) => !ev.shiftKey ? p : s; | ||
switch (ev.keyCode) { |
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.
BTW another possible implementation is having a map structure, e.g:
{
186: [';', ':'],
187: ['=', '+'],
188: [',', '<'],
.....
}
And then essentially just do a lookup in map to get actual code.
Let me know if you guys prefer the map instead and I can re-implement.
src/Terminal.ts
Outdated
} else if (ev.keyCode >= 48 && ev.keyCode <= 57) { | ||
result.key = C0.ESC + (ev.keyCode - 48); | ||
} else { | ||
const t = (p, s) => !ev.shiftKey ? p : s; | ||
switch (ev.keyCode) { |
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.
BTW another possible implementation is having a map structure, e.g:
{
186: [';', ':'],
187: ['=', '+'],
188: [',', '<'],
.....
}
And then essentially just do a lookup in map to get actual code.
Let me know if you guys prefer the map instead and I can re-implement.
@Tyriar what are your thoughts on this PR? I don't mind dropping the whole branch and starting afresh if you give me some high-level guidance/pointers. Ideally we could solve the following two use-cases:
For the |
Sorry about not getting to this, a few things:
|
@Tyriar -- cool, will re-implement using the |
Tried with both
Yup, on Mac OSX both the Same with
This tool shows the tilde as a DEADKEY; however iTerm2 outputs appropriate distinct sequences
All of the new mappings are exactly mirroring the sequences emitted with iTerm2/Terminal.app. This was verified using the |
* Reimplemented reg + shift alt digits and characters using a map * Add test cases for digits
@Tyriar this PR is ready for review. Keycode -> key mapping has been re-implemented using a map (actually an As I mentioned in the previous comment, all key -> key sequences introduced in this PR match exactly what iTerm2 emits. On bash, here are some of the mappings you can try (enable
Let me know if you have any questions or would like further changes. Thanks! |
* Add mapping for backward slash * Fix mapping for single/double quote
@Tyriar friendly ping. What are your thoughts on the PR? |
@saamalik I like it, just might take some time to give it a full review/test. I don't expect many more changes needed to get it merged. I'm hoping to get it in for 3.1.0 😃 |
@Tyriar btw let me know if you'd like me to squash all commits on top of origin/master. |
@saamalik should be fine without that |
@Tyriar just another friendly ping to see if we could please get this merged-in? |
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.
Sorry about the delay, super busy working on terminal splitting for VS Code 😅
This looks good and also seems to work as advertised so I'll merge. Thanks a bunch for the PR!
@Tyriar wohoo -- thanks! |
Follow up to #1225.
Fixes #1267
Sample bash key sequences to try:
ctrl+alt+y
: yank first argument from previous commandalt+.
: yank last argument previous command