terminal/doc
Mike Griese 6a4c737686
Add support for arbitrary args in keybindings (#3391)
## Summary of the Pull Request

Enables the user to provide arbitrary argument values to shortcut actions through a new `args` member of keybindings. For some keybindings, like `NewTabWithProfile<N>`, we previously needed 9 different `ShortcutAction`s, one for each value of `Index`. If a user wanted to have a `NewTabWithProfile11` keybinding, that was simply impossible. Now that the args are in their own separate json object, each binding can accept any number of arbitrary argument values.

So instead of:
```json
        { "command": "newTab", "keys": ["ctrl+shift+t"] },
        { "command": "newTabProfile0", "keys": ["ctrl+shift+1"] },
        { "command": "newTabProfile1", "keys": ["ctrl+shift+2"] },
        { "command": "newTabProfile2", "keys": ["ctrl+shift+3"] },
        { "command": "newTabProfile3", "keys": ["ctrl+shift+4"] },
```

We can now use:

```json
        { "command": "newTab", "keys": ["ctrl+shift+t"] },
        { "command": { "action": "newTab", "index": 0 }, "keys": ["ctrl+shift+1"] },
        { "command": { "action": "newTab", "index": 1 }, "keys": ["ctrl+shift+2"] },
        { "command": { "action": "newTab", "index": 2 }, "keys": ["ctrl+shift+3"] },
```

Initially, this does seem more verbose. However, for cases where there are multiple args, or there's a large range of values for the args, this will quickly become a more powerful system of expressing keybindings.

The "legacy" keybindings are _left in_ in this PR. They have helper methods to generate appropriate `IActionArgs` values. Prior to releasing 1.0, I think we should remove them, if only to remove some code bloat.

## References

See [the spec](https://github.com/microsoft/terminal/blob/master/doc/specs/%231142%20-%20Keybinding%20Arguments.md) for more details.

This is part two of the implementation, part one was #2446

## PR Checklist
* [x] Closes #1142
* [x] I work here
* [x] Tests added/passed
* [x] Schema updated

## Validation Steps Performed

* Ran Tests
* Removed the legacy keybindings from the `defaults.json`, everything still works
* Tried leaving the legacy keybingings in my `profiles.json`, everything still works.

-------------------------------------------------
* this is a start, but there's a weird linker bug if I take the SetKeybinding(ShortcutAction, KeyChord) implementation out, which I don't totally understand

* a good old-fashioned clean will fix that right up

* all these things work

* hey this actually _functionally_ works

* Mostly cleanup and completion of implementation

* Hey I bet we could just make NewTab the handler for NewTabWithProfile

* Start writing tests for Keybinding args

* Add tests

* Revert a bad sln change, and clean out dead code

* Change to include "command" as a single object

  This is a change to make @dhowett-msft happy. Changes the args to be a part
  of the "command" object, as opposed to an object on their own.

  EX:

  ```jsonc

    // Old style
    { "command": "switchToTab0", "keys": ["ctrl+1"] },
    { "command": { "action": "switchToTab", "index": 0 }, "keys": ["ctrl+alt+1"] },

    // new style
    { "command": "switchToTab0", "keys": ["ctrl+1"] },
    { "command": "switchToTab", "args": { "index": 0 } "keys": ["ctrl+alt+1"] },

  ```

* schemas are hard yo

* Fix the build?

* wonder why my -Wall settings are different than CI...

* this makes me hate things

* Comments from PR

  * Add a `Direction::None`
  * LOAD BEARING
  * add some GH ids to TODOs

* add a comment

* PR nits from carlos
2019-11-14 16:23:40 -06:00
..
cascadia Add support for arbitrary args in keybindings (#3391) 2019-11-14 16:23:40 -06:00
images Address #2369: Add & update install instructions , inc. VC14 redist (#3122) 2019-10-11 12:45:05 -07:00
reference added UTF8 torture test text file and a solution dependency graph diagram. (#1166) 2019-06-07 15:54:04 -05:00
specs minor typo fix (#2863) 2019-09-24 15:34:26 -07:00
user-docs Create a doc for adding common third-party tools (#3353) 2019-11-06 15:14:43 -06:00
AddASetting.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
bot.md Changed feedback hub request rule (#2680) 2019-09-06 08:55:13 -05:00
building.md Update building.md (#2501) 2019-08-29 09:46:32 -07:00
ConsoleCtrlEvent.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
ConsoleHostSettings.md Added information on WxH character (#2104) 2019-08-01 08:34:18 -05:00
Debugging.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
EXCEPTIONS.md Code highlighting and capitalization fix for doc/EXCEPTIONS.md (#1283) 2019-06-17 23:41:27 +00:00
Niksa.md Add Dustin's comment from #632 to Niksa's Doc (#2346) 2019-08-15 14:01:46 -07:00
ORGANIZATION.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
STYLE.md Changed "Windows Internal Library" to "Windows Implementation Library" (#827) 2019-05-15 12:28:22 -07:00
submitting_code.md doc: Update submitting_code.md (#2499) 2019-08-21 10:38:51 -07:00
TAEF.md Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
terminal-v1-roadmap.md Added link to Changelog for 1910 (#3357) 2019-10-31 10:08:22 -05:00
UniversalTest.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00
virtual-dtors.md doc: minor typo fix (#2860) 2019-09-23 19:58:02 -07:00
WIL.md Fix WIL doc summary (#786) 2019-05-14 13:11:41 -07:00
WindowsTestPasses.md Fixed typo's and improved consistency. (#704) 2019-05-15 21:02:42 -07:00