Repository navigation
Closed
Labels
Area-InputRelated to input processing (key presses, mouse, etc.)Related to input processing (key presses, mouse, etc.)Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Help WantedWe encourage anyone to jump in on these.We encourage anyone to jump in on these.Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Complex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.The new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.Fix is checked in, but it might be 3-4 weeks until a release.
Milestone
Description
Description of the new feature/enhancement
On Windows, there are difference between CTRL + C and CTRL + BREAK, as mentioned in #1118.
Some keyboard layouts do not have the BREAK key. For example, on Surface keyboard, there are no BREAK key. In some situations, CTRL + BREAK is a crucial way to break some processes.
Will be great if Windows Terminal has a command to map CTRL + BREAK to some other keys, e.g. CTRL + SHIFT + BREAK.
Proposed technical implementation details (optional)
Reacted by Patrick Meinecke, Mustafa Mohamad, damnskippy, Stéphane BARIZIEN and Wallison Santos
Metadata
Metadata
Assignees
Labels
Area-InputRelated to input processing (key presses, mouse, etc.)Related to input processing (key presses, mouse, etc.)Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)Help WantedWe encourage anyone to jump in on these.We encourage anyone to jump in on these.Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Complex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.The new Windows Terminal.Resolution-Fix-CommittedFix is checked in, but it might be 3-4 weeks until a release.Fix is checked in, but it might be 3-4 weeks until a release.
Activity
zadjii-msft commentedon Dec 2, 2019
I could have sworn that we had an issue that was "I want to be able to send input to the Terminal with a keybinding" but it doesn't seem like we do. Congratulations! This is now that issue☺️
Previously mentioned (in #2046):
[-]Command for sending CTRL+BREAK[/-][+]Enable sending input to the Terminal with a keybinding[/+]j4james commentedon Dec 2, 2019
In case this affects the implementation, note that there are a couple of VT escape sequences for reprogramming the keyboard which we may want to support one day (e.g.
DECUDKandDECPFK).Also I think issue #2005 is quite similar to this.
7 remaining items
zadjii-msft commentedon Jul 31, 2020
No real commitments on this one quite yet. I especially want to do this for it's potential integration with the command palette (#5400). The hardest part of this is honestly just designing exactly how the setting should work. How will arrow keys be encoded in the settings file? Trailing newlines? etc.
The implementation itself should be fairly trivial
damnskippy commentedon Jul 31, 2020
Wonder if it's an option to specify a sequence/string of characters bound to a key shortcut. User can input the escape sequence for the key they want to enter. For example, left arrrow will be
"\x1b[D". This would also allow for the other use case for this i.e. to be able to enter an arbitrary text (as opposed to mapping to another key). SayF12is mapped to a character sequence"text entered over and over again\n"(including the newline). I believe Alacritty does something like this.Just a thought, not sure how useful.
lhecker commentedon Aug 10, 2020
I'd like to implement this feature, if you don't mind. 🙂
I believe this feature is crucial, but realistically will probably only be used by a small fraction of all Windows Terminal users.
As such it'd be best in my opinion to keep the feature as straightforward and low level as possible. That way it's easy to implement and simultaneously very powerful.
Config
I imagine a potential config setting to look like the following:
Unfortunately I don't have a solution for CtrlBreak as that's equivalent to calling
TerminateProcessand AFAICS you may just as well close the offending tab, right? 🤔Implementation
ShortcutActionDispatchwithSendInput.TerminalPage::_HandleSendInputmethod which callsTermControl::SendInputwith thecommand.inputvalue .TermControl::SendInputmethod which callsTermControl::_SendInputToConnectionwith the given input value.Future extension
The above solution is very technical, but IMO sufficient for an initial implementation and can still be extended later on.
For instance the Win32 key sequences could also be represented with a JSON object instead.
zadjii-msft commentedon Aug 10, 2020
Thoughts off the top of the dome:
\u001bto be the encoding for escape (for json's sake). I don't love that, but I think json will explode on\x1bTermControl::SendInput(hstring input)as a method projected off of theTermControlclass, rather than return a tuple fromTryKeyChord. Then, just haveTerminalPageactually send the string to the control, kinda like it handles paste or other actions with args:The implementation of
SendInputwould be as easy as you suggest - the contents ofrealArgs.Input()are directly given toTermControl::_SendInputToConnection.I'm totally on board with this, thanks for the writeup! I'll throw you on the Assigned To line 😉
lhecker commentedon Aug 10, 2020
Aww... I always thought WT uses JSON5, but it seems it's using JSONC. (JSON5 supports
\xNNescape codes.) *insert comment about using YAML here* 😄Thanks Mike Griese (@zadjii-msft)! I wasn't aware about
AppKeyBindings::SetDispatchand how it integrates intoTerminalPage.I've edited my proposal above to use unicode escape codes and changed the implementation section.
Fixed #3799: Introduce sendInput command (#7249)