Skip to content
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 a spec draft for Keybindings Arguments #1349

Merged
merged 6 commits into from Aug 16, 2019

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

The goal of this change is to both simplify the keybindings, and also enable far
more flexibility when editing a user's keybindings.

Currently, we have many actions that are very similar in implementation - for
example, newTabProfile0, newTabProfile1, newTabProfile2, etc. All these
actions are fundamentally the same function. However, we've needed to define 9
different actions to enable the user to provide different values to the newTab
function.

With this change, we'll be able to remove these essentially duplicated events,
and allow the user to specify arbitrary arguments to these functions.

References

Might play into #968, since there's some discussion of to munge or not to munge with the default keybinding for copy. This would make it easy to add both.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Just read the spec :)

Validation Steps Performed

It's a spec.

@zadjii-msft zadjii-msft added Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Jun 20, 2019
@zadjii-msft zadjii-msft requested a review from a team June 20, 2019 18:28
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
binding automatically recieves the number pressed as an arg? I couldn't find
any prior art of this, so it doesn't seem worth it to try and invent
currently. This might be something that we want to loop back on, but for the
time being, it remains out of scope of this PR.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link future idea to open issue?

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spec draft. This sets a great example. I didn't have any major issues.

Co-Authored-By: Carlos Zamora <carlos.zamora@microsoft.com>
@carlos-zamora
Copy link
Member

Might not need to be on the spec but don't forget about Dustin's Design Notes here regarding Handled() for key events.

```

Note that instead of having 9 different `newTabProfile<N>` actions, we have a
singular `newTabProfile` action, and that action requires a `profileIndex` in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this informative or normative? That is: does the spec specify that newTabProfile MUST have an index or that it MAY have an index? What about a GUID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh. It makes sense that it could alternatively have a GUID. But then how would we handle if both existed in the args? I guess we can't really have an optional member, now can we?

doc/cascadia/Keybindings-Arguments.md Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 9, 2019
  * Split up ActionArgs and ActionEventArgs
  * Clarify _not_ handling an action
  * Add some notes on parsing args
  * Add some future considerations on extensions
doc/cascadia/Keybindings-Arguments.md Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
doc/cascadia/Keybindings-Arguments.md Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 13, 2019
…ntArgs` implementations, as they're redundant.
@zadjii-msft zadjii-msft merged commit c70fb49 into master Aug 16, 2019
@zadjii-msft zadjii-msft deleted the dev/migrie/s/1142-keybindings-args branch August 16, 2019 21:33
DHowett-MSFT pushed a commit that referenced this pull request Aug 16, 2019
This commit also transitions our keybinding events and event handlers to a
TypedEventHandler model with an "event args" class, as specified in the
keybinding arguments specification (#1349). In short, every event can be marked
Handled independently, and a Handled event will stop bubbling out to the
terminal. An unhandled event will be passed off to the terminal as a standard
keypress.

This unifies our keybinding event model and provides a convenient place for
binding arguments to live.

Fixes #2285.
Related to #1349, #1142.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Docs It's a documentation issue that really should be on MicrosoftDocs/Console-Docs Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants