@@ -2944,6 +2944,13 @@ namespace winrt::TerminalApp::implementation
2944
2944
2945
2945
void TerminalPage::_SearchMissingCommandHandler (const IInspectable /* sender*/ , const winrt::Microsoft::Terminal::Control::SearchMissingCommandEventArgs args)
2946
2946
{
2947
+ // If the user doesn't want to see this message again,
2948
+ // don't even bother trying to search for the command
2949
+ if (_IsMessageDismissed (InfoBarMessage::CommandNotFound))
2950
+ {
2951
+ return ;
2952
+ }
2953
+ #if 0
2947
2954
static constexpr CLSID CLSID_PackageManager = { 0xC53A4F16, 0x787E, 0x42A4, 0xB3, 0x04, 0x29, 0xEF, 0xFB, 0x4B, 0xF5, 0x97 }; //C53A4F16-787E-42A4-B304-29EFFB4BF597
2948
2955
static constexpr CLSID CLSID_FindPackagesOptions = { 0x572DED96, 0x9C60, 0x4526, { 0x8F, 0x92, 0xEE, 0x7D, 0x91, 0xD3, 0x8C, 0x1A } }; //572DED96-9C60-4526-8F92-EE7D91D38C1A
2949
2956
static constexpr CLSID CLSID_PackageMatchFilter = { 0xD02C9DAF, 0x99DC, 0x429C, { 0xB5, 0x03, 0x4E, 0x50, 0x4E, 0x4A, 0xB0, 0x00 } }; //D02C9DAF-99DC-429C-B503-4E504E4AB000
@@ -3088,6 +3095,24 @@ namespace winrt::TerminalApp::implementation
3088
3095
3089
3096
ShowCommandNotFoundInfoBar(suggestions, footer);
3090
3097
}
3098
+ #elif defined(DEBUG) || defined(_DEBUG) || defined(DBG)
3099
+ const bool tooManySuggestions = false;
3100
+ const std::wstring searchOption = L"command";
3101
+ const std::wstring missingCmd = args.MissingCommand().data();
3102
+ std::vector<std::wstring> pkgList = { L"pkg1", L"pkg2", L"pkg3" };
3103
+ std::vector<std::wstring> suggestions;
3104
+ suggestions.reserve(pkgList.size());
3105
+ for (auto pkg : pkgList)
3106
+ {
3107
+ suggestions.emplace_back(fmt::format(L"winget install --id {}", pkg));
3108
+ }
3109
+
3110
+ std::wstring footer = tooManySuggestions ?
3111
+ fmt::format(L"winget search --{} {}", searchOption, missingCmd) :
3112
+ L"";
3113
+
3114
+ ShowCommandNotFoundInfoBar(suggestions, footer);
3115
+ #endif
3091
3116
}
3092
3117
3093
3118
winrt::fire_and_forget TerminalPage::ShowCommandNotFoundInfoBar (const std::vector<std::wstring> suggestions, std::wstring footerCmd)
@@ -4743,6 +4768,15 @@ namespace winrt::TerminalApp::implementation
4743
4768
}
4744
4769
}
4745
4770
4771
+ void TerminalPage::_CommandNotFoundDismissHandler (const IInspectable& /* sender*/ , const IInspectable& /* args*/ ) const
4772
+ {
4773
+ _DismissMessage (InfoBarMessage::CommandNotFound);
4774
+ if (const auto infoBar = FindName (L" CommandNotFoundInfoBar" ).try_as <MUX::Controls::InfoBar>())
4775
+ {
4776
+ infoBar.IsOpen (false );
4777
+ }
4778
+ }
4779
+
4746
4780
// Method Description:
4747
4781
// - Persists the user's choice not to show the information bar warning about "Windows Terminal can be set as your default terminal application"
4748
4782
// Then hides this information buffer.
0 commit comments