Skip to content

Commit 534c2d9

Browse files
committed
add debug code & dismiss button
1 parent c8d13d4 commit 534c2d9

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/cascadia/TerminalApp/TerminalPage.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -2958,6 +2958,13 @@ namespace winrt::TerminalApp::implementation
29582958

29592959
void TerminalPage::_SearchMissingCommandHandler(const IInspectable /*sender*/, const winrt::Microsoft::Terminal::Control::SearchMissingCommandEventArgs args)
29602960
{
2961+
// If the user doesn't want to see this message again,
2962+
// don't even bother trying to search for the command
2963+
if (_IsMessageDismissed(InfoBarMessage::CommandNotFound))
2964+
{
2965+
return;
2966+
}
2967+
#if 0
29612968
static constexpr CLSID CLSID_PackageManager = { 0xC53A4F16, 0x787E, 0x42A4, 0xB3, 0x04, 0x29, 0xEF, 0xFB, 0x4B, 0xF5, 0x97 }; //C53A4F16-787E-42A4-B304-29EFFB4BF597
29622969
static constexpr CLSID CLSID_FindPackagesOptions = { 0x572DED96, 0x9C60, 0x4526, { 0x8F, 0x92, 0xEE, 0x7D, 0x91, 0xD3, 0x8C, 0x1A } }; //572DED96-9C60-4526-8F92-EE7D91D38C1A
29632970
static constexpr CLSID CLSID_PackageMatchFilter = { 0xD02C9DAF, 0x99DC, 0x429C, { 0xB5, 0x03, 0x4E, 0x50, 0x4E, 0x4A, 0xB0, 0x00 } }; //D02C9DAF-99DC-429C-B503-4E504E4AB000
@@ -3102,6 +3109,24 @@ namespace winrt::TerminalApp::implementation
31023109

31033110
ShowCommandNotFoundInfoBar(suggestions, footer);
31043111
}
3112+
#elif defined(DEBUG) || defined(_DEBUG) || defined(DBG)
3113+
const bool tooManySuggestions = false;
3114+
const std::wstring searchOption = L"command";
3115+
const std::wstring missingCmd = args.MissingCommand().data();
3116+
std::vector<std::wstring> pkgList = { L"pkg1", L"pkg2", L"pkg3" };
3117+
std::vector<std::wstring> suggestions;
3118+
suggestions.reserve(pkgList.size());
3119+
for (auto pkg : pkgList)
3120+
{
3121+
suggestions.emplace_back(fmt::format(L"winget install --id {}", pkg));
3122+
}
3123+
3124+
std::wstring footer = tooManySuggestions ?
3125+
fmt::format(L"winget search --{} {}", searchOption, missingCmd) :
3126+
L"";
3127+
3128+
ShowCommandNotFoundInfoBar(suggestions, footer);
3129+
#endif
31053130
}
31063131

31073132
winrt::fire_and_forget TerminalPage::ShowCommandNotFoundInfoBar(const std::vector<std::wstring> suggestions, std::wstring footerCmd)
@@ -4730,6 +4755,15 @@ namespace winrt::TerminalApp::implementation
47304755
}
47314756
}
47324757

4758+
void TerminalPage::_CommandNotFoundDismissHandler(const IInspectable& /*sender*/, const IInspectable& /*args*/) const
4759+
{
4760+
_DismissMessage(InfoBarMessage::CommandNotFound);
4761+
if (const auto infoBar = FindName(L"CommandNotFoundInfoBar").try_as<MUX::Controls::InfoBar>())
4762+
{
4763+
infoBar.IsOpen(false);
4764+
}
4765+
}
4766+
47334767
// Method Description:
47344768
// - Checks whether information bar message was dismissed earlier (in the application state)
47354769
// Arguments:

0 commit comments

Comments
 (0)