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

Updated pane context menu #18126

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0ac796f
added split up/down/left/right context menus
dmitrykok Oct 29, 2024
d920a70
added build win x64 release script
dmitrykok Oct 29, 2024
7e41e64
moved split up/down/left/right context menus as submenu
dmitrykok Oct 30, 2024
58cbe3a
added to split with profile to up/down/left/right context menu, added…
dmitrykok Oct 30, 2024
6e2529b
fix startup directory for split with profile to up/down/left/right co…
dmitrykok Oct 30, 2024
c953b44
Merge branch 'microsoft:main' into main
dmitrykok Oct 30, 2024
ef25c63
update win x64 release build script
dmitrykok Oct 30, 2024
f900ea5
added translations for available languages
dmitrykok Oct 30, 2024
a57aff8
Update settings.json
dmitrykok Oct 30, 2024
ae838ec
Update settings.json
dmitrykok Oct 30, 2024
ab01742
removed newly added file
dmitrykok Oct 30, 2024
4ab861c
put back comments removed by mistake in TerminalPage.cpp, revert the …
dmitrykok Oct 30, 2024
409783a
revert .vscode/settings.json
dmitrykok Oct 30, 2024
e21c0b7
fixed Resources.resw SwapPaneText resource
dmitrykok Nov 1, 2024
12aad74
Update TerminalPage.cpp
dmitrykok Nov 1, 2024
f682222
the split pane entries exists twice on the second level, add a 'dupli…
dmitrykok Nov 2, 2024
3bcaa51
add visible with a separation line between the 'duplicate' entry and …
dmitrykok Nov 7, 2024
2c303d0
Update TerminalPage.cpp
dmitrykok Nov 7, 2024
0cabf20
fixed pane context menu separators
dmitrykok Nov 7, 2024
e6f0d6a
Update TerminalPage.cpp
dmitrykok Nov 7, 2024
526e0a9
fixed pane context menu separators, and formatting
dmitrykok Nov 7, 2024
52dbc03
Merge branch 'main' of github.com:dmitrykok/terminal
dmitrykok Nov 7, 2024
82aa44a
fixed formatting
dmitrykok Nov 7, 2024
bf1e135
update swap menu, show only available options
dmitrykok Nov 8, 2024
1d5a220
add find to context menu even if there is no selection
dmitrykok Nov 8, 2024
54c9c60
Update src/cascadia/TerminalApp/Resources/en-US/Resources.resw
dmitrykok Dec 11, 2024
9a936f4
cache the value of focusedProfile.Name() and focusedProfile.Icon(), c…
dmitrykok Dec 11, 2024
8cf4ad6
No need to manually override the value from the profile, with the val…
dmitrykok Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@
"**/obj/**": true,
"**/packages/**": true,
},
}
}
1,909 changes: 971 additions & 938 deletions src/cascadia/TerminalApp/Resources/de-DE/Resources.resw

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,39 @@
<data name="SplitPaneText" xml:space="preserve">
<value>Split pane</value>
</data>
<data name="SplitPaneDownText" xml:space="preserve">
<value>Split Pane Down</value>
dmitrykok marked this conversation as resolved.
Show resolved Hide resolved
</data>
<data name="SplitPaneRightText" xml:space="preserve">
<value>Split Pane Right</value>
</data>
<data name="SplitPaneUpText" xml:space="preserve">
<value>Split Pane Up</value>
</data>
<data name="SplitPaneLeftText" xml:space="preserve">
<value>Split Pane Left</value>
</data>
<data name="SwapPaneText" xml:space="preserve">
<value>Split pane</value>
</data>
<data name="SwapPaneDownText" xml:space="preserve">
<value>Swap Pane Down</value>
</data>
<data name="SwapPaneRightText" xml:space="preserve">
<value>Swap Pane Right</value>
</data>
<data name="SwapPaneUpText" xml:space="preserve">
<value>Swap Pane Up</value>
</data>
<data name="SwapPaneLeftText" xml:space="preserve">
<value>Swap Pane Left</value>
</data>
<data name="TogglePaneZoomText" xml:space="preserve">
<value>Toggle Pane Zoom</value>
</data>
<data name="CloseOtherPanesText" xml:space="preserve">
<value>Close Other Panes</value>
</data>
<data name="SearchWebText" xml:space="preserve">
<value>Web search</value>
</data>
Expand Down
1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/es-ES/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/fr-FR/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/it-IT/Resources.resw

Large diffs are not rendered by default.

1,905 changes: 969 additions & 936 deletions src/cascadia/TerminalApp/Resources/ja-JP/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/ko-KR/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/pt-BR/Resources.resw

Large diffs are not rendered by default.

1,921 changes: 977 additions & 944 deletions src/cascadia/TerminalApp/Resources/qps-ploc/Resources.resw

Large diffs are not rendered by default.

1,921 changes: 977 additions & 944 deletions src/cascadia/TerminalApp/Resources/qps-ploca/Resources.resw

Large diffs are not rendered by default.

1,921 changes: 977 additions & 944 deletions src/cascadia/TerminalApp/Resources/qps-plocm/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/ru-RU/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/zh-CN/Resources.resw

Large diffs are not rendered by default.

1,903 changes: 968 additions & 935 deletions src/cascadia/TerminalApp/Resources/zh-TW/Resources.resw

Large diffs are not rendered by default.

93 changes: 71 additions & 22 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5012,18 +5012,11 @@ namespace winrt::TerminalApp::implementation
const MUX::Controls::CommandBarFlyout& menu,
const bool withSelection)
{
// withSelection can be used to add actions that only appear if there's
dmitrykok marked this conversation as resolved.
Show resolved Hide resolved
// selected text, like "search the web"

if (!control || !menu)
{
return;
}

// Helper lambda for dispatching an ActionAndArgs onto the
// ShortcutActionDispatch. Used below to wire up each menu entry to the
// respective action.

auto weak = get_weak();
auto makeCallback = [weak](const ActionAndArgs& actionAndArgs) {
return [weak, actionAndArgs](auto&&, auto&&) {
Expand All @@ -5034,9 +5027,10 @@ namespace winrt::TerminalApp::implementation
};
};

auto makeItem = [&menu, &makeCallback](const winrt::hstring& label,
const winrt::hstring& icon,
const auto& action) {
auto makeItem = [&makeCallback](const winrt::hstring& label,
const winrt::hstring& icon,
const auto& action,
auto& targetMenu) {
AppBarButton button{};

if (!icon.empty())
Expand All @@ -5048,34 +5042,89 @@ namespace winrt::TerminalApp::implementation

button.Label(label);
button.Click(makeCallback(action));
menu.SecondaryCommands().Append(button);
targetMenu.SecondaryCommands().Append(button);
};

// Wire up each item to the action that should be performed. By actually
// connecting these to actions, we ensure the implementation is
// consistent. This also leaves room for customizing this menu with
// actions in the future.
auto makeMenuItem = [](const winrt::hstring& label,
const winrt::hstring& icon,
const auto& subMenu,
auto& targetMenu) {
AppBarButton button{};

if (!icon.empty())
{
auto iconElement = UI::IconPathConverter::IconWUX(icon);
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
button.Icon(iconElement);
}

makeItem(RS_(L"SplitPaneText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate } });
makeItem(RS_(L"DuplicateTabText"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr });
button.Label(label);
button.Flyout(subMenu);
targetMenu.SecondaryCommands().Append(button);
};

auto activeProfiles = _settings.ActiveProfiles();
auto activeProfileCount = gsl::narrow_cast<int>(activeProfiles.Size());

makeItem(RS_(L"DuplicateTabText"), L"\xF5ED", ActionAndArgs{ ShortcutAction::DuplicateTab, nullptr }, menu);

MUX::Controls::CommandBarFlyout splitPaneDownMenu{};
MUX::Controls::CommandBarFlyout splitPaneUpMenu{};
MUX::Controls::CommandBarFlyout splitPaneRightMenu{};
MUX::Controls::CommandBarFlyout splitPaneLeftMenu{};
for (auto profileIndex = 0; profileIndex < activeProfileCount; profileIndex++)
{
const auto profile = activeProfiles.GetAt(profileIndex);
NewTerminalArgs args{};
args.Profile(profile.Name());
args.StartingDirectory(_evaluatePathForCwd(profile.EvaluatedStartingDirectory()));
args.TabTitle(profile.TabTitle());
args.Commandline(profile.Commandline());
args.SuppressApplicationTitle(profile.SuppressApplicationTitle());
dmitrykok marked this conversation as resolved.
Show resolved Hide resolved
makeItem(profile.Name(), profile.Icon(), ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Manual, SplitDirection::Down, .5, args } }, splitPaneDownMenu);
dmitrykok marked this conversation as resolved.
Show resolved Hide resolved
makeItem(profile.Name(), profile.Icon(), ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Manual, SplitDirection::Up, .5, args } }, splitPaneUpMenu);
makeItem(profile.Name(), profile.Icon(), ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Manual, SplitDirection::Right, .5, args } }, splitPaneRightMenu);
makeItem(profile.Name(), profile.Icon(), ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Manual, SplitDirection::Left, .5, args } }, splitPaneLeftMenu);
}

MUX::Controls::CommandBarFlyout splitPaneMenu{};
makeItem(RS_(L"SplitPaneDownText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate, SplitDirection::Down, .5, nullptr } }, splitPaneMenu);
makeItem(RS_(L"SplitPaneRightText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate, SplitDirection::Right, .5, nullptr } }, splitPaneMenu);
makeItem(RS_(L"SplitPaneUpText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate, SplitDirection::Up, .5, nullptr } }, splitPaneMenu);
makeItem(RS_(L"SplitPaneLeftText"), L"\xF246", ActionAndArgs{ ShortcutAction::SplitPane, SplitPaneArgs{ SplitType::Duplicate, SplitDirection::Left, .5, nullptr } }, splitPaneMenu);

makeMenuItem(RS_(L"SplitPaneDownText"), L"\xF246", splitPaneDownMenu, splitPaneMenu);
makeMenuItem(RS_(L"SplitPaneRightText"), L"\xF246", splitPaneRightMenu, splitPaneMenu);
makeMenuItem(RS_(L"SplitPaneUpText"), L"\xF246", splitPaneUpMenu, splitPaneMenu);
makeMenuItem(RS_(L"SplitPaneLeftText"), L"\xF246", splitPaneLeftMenu, splitPaneMenu);

makeMenuItem(RS_(L"SplitPaneText"), L"\xF246", splitPaneMenu, menu);

// Only wire up "Close Pane" if there's multiple panes.
if (_GetFocusedTabImpl()->GetLeafPaneCount() > 1)
{
makeItem(RS_(L"PaneClose"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr });
MUX::Controls::CommandBarFlyout swapPaneMenu{};
makeItem(RS_(L"SwapPaneDownText"), L"\xF1CB", ActionAndArgs{ ShortcutAction::SwapPane, SwapPaneArgs{ FocusDirection::Down } }, swapPaneMenu);
makeItem(RS_(L"SwapPaneRightText"), L"\xF1CB", ActionAndArgs{ ShortcutAction::SwapPane, SwapPaneArgs{ FocusDirection::Right } }, swapPaneMenu);
makeItem(RS_(L"SwapPaneUpText"), L"\xF1CB", ActionAndArgs{ ShortcutAction::SwapPane, SwapPaneArgs{ FocusDirection::Up } }, swapPaneMenu);
makeItem(RS_(L"SwapPaneLeftText"), L"\xF1CB", ActionAndArgs{ ShortcutAction::SwapPane, SwapPaneArgs{ FocusDirection::Left } }, swapPaneMenu);
makeMenuItem(RS_(L"SwapPaneText"), L"\xF1CB", swapPaneMenu, menu);

makeItem(RS_(L"TogglePaneZoomText"), L"\xE8A3", ActionAndArgs{ ShortcutAction::TogglePaneZoom, nullptr }, menu);
makeItem(RS_(L"CloseOtherPanesText"), L"\xE89F", ActionAndArgs{ ShortcutAction::CloseOtherPanes, nullptr }, menu);
makeItem(RS_(L"PaneClose"), L"\xE89F", ActionAndArgs{ ShortcutAction::ClosePane, nullptr }, menu);
}

if (control.ConnectionState() >= ConnectionState::Closed)
{
makeItem(RS_(L"RestartConnectionText"), L"\xE72C", ActionAndArgs{ ShortcutAction::RestartConnection, nullptr });
makeItem(RS_(L"RestartConnectionText"), L"\xE72C", ActionAndArgs{ ShortcutAction::RestartConnection, nullptr }, menu);
}

if (withSelection)
{
makeItem(RS_(L"SearchWebText"), L"\xF6FA", ActionAndArgs{ ShortcutAction::SearchForText, nullptr });
makeItem(RS_(L"SearchWebText"), L"\xF6FA", ActionAndArgs{ ShortcutAction::SearchForText, nullptr }, menu);
}

makeItem(RS_(L"TabClose"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } });
makeItem(RS_(L"TabClose"), L"\xE711", ActionAndArgs{ ShortcutAction::CloseTab, CloseTabArgs{ _GetFocusedTabIndex().value() } }, menu);
}

void TerminalPage::_PopulateQuickFixMenu(const TermControl& control,
Expand Down
Loading