Skip to content

Commit

Permalink
Replace "bindings" with "actions" (#7332)
Browse files Browse the repository at this point in the history
In #6532, we thought it would be a good idea to add "bindings" as an
overload for "keybindings", as we were no longer going to use the
keybindings array for just keybindings. We were going to add commands.
So we started secretly treating `"bindings"` the same as
`"keybindings"`.

Then, in #7175, we discussed using "actions" as the key for the list of
commands/keybindings/global actions, instead of using "bindings". We're
going to be using this array as the global list of all actions, so it
makes sense to just call it `"actions"`. 

This PR renames "bindings" to "actions". Fortunately, we never
documented the "bindings" overload in the first place, so we can get
away with this safely, and preferably before we ship "bindings" for too
long.

References #6899
  • Loading branch information
zadjii-msft authored Aug 20, 2020
1 parent 4814c4f commit 2c4b868
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2438,7 +2438,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{ "keys": "ctrl+a", "command": { "action": "splitPane", "split": "vertical" } },
{ "name": "ctrl+b", "command": { "action": "splitPane", "split": "vertical" } },
{ "keys": "ctrl+c", "name": "ctrl+c", "command": { "action": "splitPane", "split": "vertical" } },
Expand Down Expand Up @@ -2640,7 +2640,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "iterable command ${profile.name}",
"iterateOn": "profiles",
Expand Down Expand Up @@ -2771,7 +2771,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"iterateOn": "profiles",
"command": { "action": "splitPane", "profile": "${profile.name}" }
Expand Down Expand Up @@ -2902,7 +2902,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "iterable command ${profile.name}",
"iterateOn": "profiles",
Expand Down Expand Up @@ -3039,7 +3039,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "Connect to ssh...",
"commands": [
Expand Down Expand Up @@ -3142,7 +3142,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "grandparent",
"commands": [
Expand Down Expand Up @@ -3290,7 +3290,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"iterateOn": "profiles",
"name": "${profile.name}...",
Expand Down Expand Up @@ -3443,7 +3443,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "New Tab With Profile...",
"commands": [
Expand Down Expand Up @@ -3551,7 +3551,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "New Pane...",
"commands": [
Expand Down Expand Up @@ -3714,7 +3714,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"commands": [
{
Expand Down Expand Up @@ -3777,7 +3777,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "parent",
"commands": [
Expand All @@ -3798,7 +3798,7 @@ namespace TerminalAppLocalTests
const std::string settings1Json{ R"(
{
"defaultProfile": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
"bindings": [
"actions": [
{
"name": "parent",
"commands": null
Expand Down Expand Up @@ -3860,7 +3860,7 @@ namespace TerminalAppLocalTests
"commandline": "wsl.exe"
}
],
"bindings": [
"actions": [
{
"name": "parent",
"commands": [
Expand All @@ -3881,7 +3881,7 @@ namespace TerminalAppLocalTests
const std::string settings1Json{ R"(
{
"defaultProfile": "{6239a42c-0000-49a3-80bd-e8fdd045185c}",
"bindings": [
"actions": [
{
"name": "parent",
"command": "newTab"
Expand Down
4 changes: 2 additions & 2 deletions src/cascadia/TerminalApp/GlobalAppSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace ::Microsoft::Console;
using namespace winrt::Microsoft::UI::Xaml::Controls;

static constexpr std::string_view LegacyKeybindingsKey{ "keybindings" };
static constexpr std::string_view BindingsKey{ "bindings" };
static constexpr std::string_view ActionsKey{ "actions" };
static constexpr std::string_view DefaultProfileKey{ "defaultProfile" };
static constexpr std::string_view AlwaysShowTabsKey{ "alwaysShowTabs" };
static constexpr std::string_view InitialRowsKey{ "initialRows" };
Expand Down Expand Up @@ -202,7 +202,7 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)
}
};
parseBindings(LegacyKeybindingsKey);
parseBindings(BindingsKey);
parseBindings(ActionsKey);
}

// Method Description:
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/defaults-universal.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"brightWhite": "#FFFFFF"
}
],
"keybindings":
"actions":
[
// Application-level Keys
{ "command": "closeWindow", "keys": "alt+f4" },
Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalApp/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"brightWhite": "#EEEEEC"
}
],
"bindings":
"actions":
[
// Application-level Keys
{ "command": "closeWindow", "keys": "alt+f4" },
Expand Down

0 comments on commit 2c4b868

Please sign in to comment.