Skip to content

Commit

Permalink
Add default bindings for "move tab/pane to a new window" (#15258)
Browse files Browse the repository at this point in the history
This was in pursuit of #15156. I need an ack from OP to make sure this
is good enough.

Related to #14957
  • Loading branch information
zadjii-msft authored May 1, 2023
1 parent 20eabb3 commit 1da6131
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cascadia/TerminalSettingsModel/ActionArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
if (!Window().empty())
{
// Special case for moving to a new window. We can just ignore the
// tab index, because it _doesn't matter_. There won't be any tabs
// in the new window, till we get there.
if (Window() == L"new")
{
return RS_(L"MovePaneToNewWindowCommandKey");
}
return winrt::hstring{
fmt::format(L"{}, window:{}, tab index:{}", RS_(L"MovePaneCommandKey"), Window(), TabIndex())
};
Expand Down Expand Up @@ -658,6 +665,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
if (!Window().empty())
{
if (Window() == L"new")
{
return RS_(L"MoveTabToNewWindowCommandKey");
}
return winrt::hstring{
fmt::format(std::wstring_view(RS_(L"MoveTabToWindowCommandKey")),
Window())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
<value>Move tab to window "{0}"</value>
<comment>{0} will be replaced with a user-specified name of a window</comment>
</data>
<data name="MoveTabToNewWindowCommandKey" xml:space="preserve">
<value>Move tab to a new window</value>
</data>
<data name="MoveTabDirectionForward" xml:space="preserve">
<value>forward</value>
</data>
Expand Down Expand Up @@ -422,6 +425,9 @@
<data name="MovePaneCommandKey" xml:space="preserve">
<value>Move pane</value>
</data>
<data name="MovePaneToNewWindowCommandKey" xml:space="preserve">
<value>Move pane to new window</value>
</data>
<data name="SplitPaneCommandKey" xml:space="preserve">
<value>Split pane</value>
</data>
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalSettingsModel/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
{ "command": { "action": "switchToTab", "index": 6 }, "keys": "ctrl+alt+7" },
{ "command": { "action": "switchToTab", "index": 7 }, "keys": "ctrl+alt+8" },
{ "command": { "action": "switchToTab", "index": 4294967295 }, "keys": "ctrl+alt+9" },
{ "command": { "action": "moveTab", "window": "new" }, },

// Pane Management
{ "command": "closeOtherPanes" },
Expand Down Expand Up @@ -449,6 +450,7 @@
{ "command": { "action": "movePane", "index": 6 } },
{ "command": { "action": "movePane", "index": 7 } },
{ "command": { "action": "movePane", "index": 8 } },
{ "command": { "action": "movePane", "window": "new" }, },
{ "command": "restartConnection" },

// Clipboard Integration
Expand Down

0 comments on commit 1da6131

Please sign in to comment.