-
Notifications
You must be signed in to change notification settings - Fork 9k
Add Quick Fix UI and support for custom CommandNotFound OSC #16848
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
Changes from 23 commits
12100c5
c8d13d4
534c2d9
c1e1eab
68ed03d
c2417bb
6a361ef
a2e57b4
cfaa09d
88b64cd
48a36be
d8c8807
8c0d7c6
ec1fbc2
767692c
d4b6904
4e5d07d
27d464c
0f801a9
a545325
755f121
a0aa2d0
1ffbae1
0c5d880
ef6af81
db7f464
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| auto pfnCompletionsChanged = [=](auto&& menuJson, auto&& replaceLength) { _terminalCompletionsChanged(menuJson, replaceLength); }; | ||
| _terminal->CompletionsChangedCallback(pfnCompletionsChanged); | ||
|
|
||
| auto pfnSearchMissingCommand = [this](auto&& PH1) { _terminalSearchMissingCommand(std::forward<decltype(PH1)>(PH1)); }; | ||
| _terminal->SetSearchMissingCommandCallback(pfnSearchMissingCommand); | ||
|
|
||
| auto pfnClearQuickFix = [this] { ClearQuickFix(); }; | ||
| _terminal->SetClearQuickFixCallback(pfnClearQuickFix); | ||
|
|
||
| // MSFT 33353327: Initialize the renderer in the ctor instead of Initialize(). | ||
| // We need the renderer to be ready to accept new engines before the SwapChainPanel is ready to go. | ||
| // If we wait, a screen reader may try to get the AutomationPeer (aka the UIA Engine), and we won't be able to attach | ||
|
|
@@ -1609,6 +1615,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| _midiAudio.PlayNote(reinterpret_cast<HWND>(_owningHwnd), noteNumber, velocity, std::chrono::duration_cast<std::chrono::milliseconds>(duration)); | ||
| } | ||
|
|
||
| void ControlCore::_terminalSearchMissingCommand(std::wstring_view missingCommand) | ||
| { | ||
| SearchMissingCommand.raise(*this, make<implementation::SearchMissingCommandEventArgs>(hstring{ missingCommand })); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 this goes up on the BG thread, then comes back down into us in |
||
| } | ||
|
|
||
| void ControlCore::ClearQuickFix() | ||
| { | ||
| _cachedQuickFixes = nullptr; | ||
| RefreshQuickFixUI.raise(*this, nullptr); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mildly alarmed that ClearQuickFix seems to refresh the QF UI but |
||
| } | ||
|
|
||
| bool ControlCore::HasSelection() const | ||
| { | ||
| const auto lock = _terminal->LockForReading(); | ||
|
|
@@ -2279,9 +2296,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
|
|
||
| auto context = winrt::make_self<CommandHistoryContext>(std::move(commands)); | ||
| context->CurrentCommandline(trimmedCurrentCommand); | ||
| context->QuickFixes(_cachedQuickFixes); | ||
| return *context; | ||
| } | ||
|
|
||
| bool ControlCore::QuickFixesAvailable() const noexcept | ||
| { | ||
| return _cachedQuickFixes && _cachedQuickFixes.Size() > 0; | ||
| } | ||
|
|
||
| void ControlCore::UpdateQuickFixes(const Windows::Foundation::Collections::IVector<hstring>& quickFixes) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is more of a |
||
| { | ||
| _cachedQuickFixes = quickFixes; | ||
| } | ||
|
|
||
| Core::Scheme ControlCore::ColorScheme() const noexcept | ||
| { | ||
| Core::Scheme s; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,8 +68,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| { | ||
| til::property<Windows::Foundation::Collections::IVector<winrt::hstring>> History; | ||
| til::property<winrt::hstring> CurrentCommandline; | ||
| til::property<Windows::Foundation::Collections::IVector<winrt::hstring>> QuickFixes; | ||
carlos-zamora marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| CommandHistoryContext(std::vector<winrt::hstring>&& history) | ||
| CommandHistoryContext(std::vector<winrt::hstring>&& history) : | ||
| QuickFixes(winrt::single_threaded_vector<winrt::hstring>()) | ||
| { | ||
| History(winrt::single_threaded_vector<winrt::hstring>(std::move(history))); | ||
| } | ||
|
|
@@ -153,6 +155,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| void PersistToPath(const wchar_t* path) const; | ||
| void RestoreFromPath(const wchar_t* path) const; | ||
|
|
||
| void ClearQuickFix(); | ||
|
|
||
| #pragma region ICoreState | ||
| const size_t TaskbarState() const noexcept; | ||
| const size_t TaskbarProgress() const noexcept; | ||
|
|
@@ -241,6 +245,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
|
|
||
| hstring ReadEntireBuffer() const; | ||
| Control::CommandHistoryContext CommandHistory() const; | ||
| bool QuickFixesAvailable() const noexcept; | ||
| void UpdateQuickFixes(const Windows::Foundation::Collections::IVector<hstring>& quickFixes); | ||
|
|
||
| void AdjustOpacity(const float opacity, const bool relative); | ||
|
|
||
|
|
@@ -285,6 +291,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| til::typed_event<IInspectable, Control::UpdateSelectionMarkersEventArgs> UpdateSelectionMarkers; | ||
| til::typed_event<IInspectable, Control::OpenHyperlinkEventArgs> OpenHyperlink; | ||
| til::typed_event<IInspectable, Control::CompletionsChangedEventArgs> CompletionsChanged; | ||
| til::typed_event<IInspectable, Control::SearchMissingCommandEventArgs> SearchMissingCommand; | ||
| til::typed_event<> RefreshQuickFixUI; | ||
|
|
||
| til::typed_event<> CloseTerminalRequested; | ||
| til::typed_event<> RestartTerminalRequested; | ||
|
|
@@ -354,6 +362,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
|
|
||
| til::point _contextMenuBufferPosition{ 0, 0 }; | ||
|
|
||
| Windows::Foundation::Collections::IVector<int32_t> _cachedSearchResultRows{ nullptr }; | ||
|
||
| Windows::Foundation::Collections::IVector<hstring> _cachedQuickFixes{ nullptr }; | ||
|
|
||
| void _setupDispatcherAndCallbacks(); | ||
|
|
||
| bool _setFontSizeUnderLock(float fontSize); | ||
|
|
@@ -377,6 +388,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |
| void _terminalPlayMidiNote(const int noteNumber, | ||
| const int velocity, | ||
| const std::chrono::microseconds duration); | ||
| void _terminalSearchMissingCommand(std::wstring_view missingCommand); | ||
|
|
||
| winrt::fire_and_forget _terminalCompletionsChanged(std::wstring_view menuJson, unsigned int replaceLength); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.