@@ -2958,6 +2958,13 @@ namespace winrt::TerminalApp::implementation
2958
2958
2959
2959
void TerminalPage::_SearchMissingCommandHandler (const IInspectable /* sender*/ , const winrt::Microsoft::Terminal::Control::SearchMissingCommandEventArgs args)
2960
2960
{
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
2961
2968
static constexpr CLSID CLSID_PackageManager = { 0xC53A4F16, 0x787E, 0x42A4, 0xB3, 0x04, 0x29, 0xEF, 0xFB, 0x4B, 0xF5, 0x97 }; //C53A4F16-787E-42A4-B304-29EFFB4BF597
2962
2969
static constexpr CLSID CLSID_FindPackagesOptions = { 0x572DED96, 0x9C60, 0x4526, { 0x8F, 0x92, 0xEE, 0x7D, 0x91, 0xD3, 0x8C, 0x1A } }; //572DED96-9C60-4526-8F92-EE7D91D38C1A
2963
2970
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
3102
3109
3103
3110
ShowCommandNotFoundInfoBar(suggestions, footer);
3104
3111
}
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
3105
3130
}
3106
3131
3107
3132
winrt::fire_and_forget TerminalPage::ShowCommandNotFoundInfoBar (const std::vector<std::wstring> suggestions, std::wstring footerCmd)
@@ -4730,6 +4755,15 @@ namespace winrt::TerminalApp::implementation
4730
4755
}
4731
4756
}
4732
4757
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
+
4733
4767
// Method Description:
4734
4768
// - Checks whether information bar message was dismissed earlier (in the application state)
4735
4769
// Arguments:
0 commit comments