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 close button to the Snippets pane #17528

Merged
merged 4 commits into from
Jul 9, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
don't crash on tearout
zadjii-msft committed Jul 8, 2024

Verified

This commit was signed with the committer’s verified signature.
a1994sc Allen Conlon
commit 44f47e1bf35b1ca96bf686d32bac559c7cd4cdfb
24 changes: 14 additions & 10 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
@@ -3311,18 +3311,22 @@ namespace winrt::TerminalApp::implementation
// Prevent the user from opening a bunch of snippets panes.
//
// Look at the focused tab, and if it already has one, then just focus it.
const bool found = _GetFocusedTab().try_as<TerminalTab>()->GetRootPane()->WalkTree([](const auto& p) -> bool {
if (const auto& snippets{ p->GetContent().try_as<SnippetsPaneContent>() })
if (const auto& focusedTab{ _GetFocusedTab() })
{
const auto rootPane{ focusedTab.try_as<TerminalTab>()->GetRootPane() };
const bool found = rootPane == nullptr ? false : rootPane->WalkTree([](const auto& p) -> bool {
if (const auto& snippets{ p->GetContent().try_as<SnippetsPaneContent>() })
{
snippets->Focus(FocusState::Programmatic);
return true;
}
return false;
});
// Bail out if we already found one.
if (found)
{
snippets->Focus(FocusState::Programmatic);
return true;
return nullptr;
}
return false;
});
// Bail out if we already found one.
if (found)
{
return nullptr;
}

const auto& tasksContent{ winrt::make_self<SnippetsPaneContent>() };