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

A trio of snippets pane fixes #17794

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions src/cascadia/TerminalApp/CommandPalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,6 @@ namespace winrt::TerminalApp::implementation
{
Visibility(Visibility::Collapsed);

PreviewAction.raise(*this, nullptr);

// Reset visibility in case anchor mode tab switcher just finished.
_searchBox().Visibility(Visibility::Visible);

Expand All @@ -1216,6 +1214,7 @@ namespace winrt::TerminalApp::implementation

ParentCommandName(L"");
_currentNestedCommands.Clear();
PreviewAction.raise(*this, nullptr);
}

void CommandPalette::EnableTabSwitcherMode(const uint32_t startIdx, TabSwitcherMode tabSwitcherMode)
Expand Down
5 changes: 3 additions & 2 deletions src/cascadia/TerminalApp/SnippetsPaneContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ namespace winrt

namespace winrt::TerminalApp::implementation
{
SnippetsPaneContent::SnippetsPaneContent()
SnippetsPaneContent::SnippetsPaneContent() :
_allTasks{ winrt::single_threaded_observable_vector<TerminalApp::FilteredTask>() }
{
InitializeComponent();

Expand Down Expand Up @@ -54,7 +55,7 @@ namespace winrt::TerminalApp::implementation
const auto tasks = co_await _settings.GlobalSettings().ActionMap().FilterToSnippets(winrt::hstring{}, winrt::hstring{}); // IVector<Model::Command>
co_await wil::resume_foreground(Dispatcher());

_allTasks = winrt::single_threaded_observable_vector<TerminalApp::FilteredTask>();
_allTasks.Clear();
for (const auto& t : tasks)
{
const auto& filtered{ winrt::make<FilteredTask>(t) };
Expand Down
6 changes: 6 additions & 0 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,12 @@ void Terminal::PreviewText(std::wstring_view input)
static constexpr TextAttribute previewAttrs{ CharacterAttributes::Italics, TextColor{}, TextColor{}, 0u, TextColor{} };

auto lock = LockForWriting();

if (_mainBuffer == nullptr)
{
return;
}

if (input.empty())
{
snippetPreview.text = L"";
Expand Down
Loading