diff --git a/src/cascadia/TerminalCore/Terminal.hpp b/src/cascadia/TerminalCore/Terminal.hpp index 01b6db5362..5cd511fe64 100644 --- a/src/cascadia/TerminalCore/Terminal.hpp +++ b/src/cascadia/TerminalCore/Terminal.hpp @@ -155,6 +155,7 @@ public: bool IsVtInputEnabled() const noexcept override; void NotifyAccessibilityChange(const til::rect& changedRect) noexcept override; void NotifyBufferRotation(const int delta) override; + void NotifyShellIntegrationMark() override; void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override; diff --git a/src/cascadia/TerminalCore/TerminalApi.cpp b/src/cascadia/TerminalCore/TerminalApi.cpp index 7d8a706274..8e9ee2603c 100644 --- a/src/cascadia/TerminalCore/TerminalApi.cpp +++ b/src/cascadia/TerminalCore/TerminalApi.cpp @@ -404,3 +404,9 @@ void Terminal::NotifyBufferRotation(const int delta) _NotifyScrollEvent(); } } + +void Terminal::NotifyShellIntegrationMark() +{ + // Notify the scrollbar that marks have been added so it can refresh the mark indicators + _NotifyScrollEvent(); +} diff --git a/src/host/outputStream.cpp b/src/host/outputStream.cpp index 3e8219a9bb..3fb736b324 100644 --- a/src/host/outputStream.cpp +++ b/src/host/outputStream.cpp @@ -446,6 +446,11 @@ void ConhostInternalGetSet::NotifyBufferRotation(const int delta) } } +void ConhostInternalGetSet::NotifyShellIntegrationMark() +{ + // Not implemented for conhost - shell integration marks are a Terminal app feature. +} + void ConhostInternalGetSet::InvokeCompletions(std::wstring_view /*menuJson*/, unsigned int /*replaceLength*/) { // Not implemented for conhost. diff --git a/src/host/outputStream.hpp b/src/host/outputStream.hpp index 7b76e5f3d0..cfb1c85f16 100644 --- a/src/host/outputStream.hpp +++ b/src/host/outputStream.hpp @@ -67,6 +67,7 @@ public: void NotifyAccessibilityChange(const til::rect& changedRect) override; void NotifyBufferRotation(const int delta) override; + void NotifyShellIntegrationMark() override; void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override; diff --git a/src/terminal/adapter/ITerminalApi.hpp b/src/terminal/adapter/ITerminalApi.hpp index 532133f9a8..3ce0e5c83d 100644 --- a/src/terminal/adapter/ITerminalApi.hpp +++ b/src/terminal/adapter/ITerminalApi.hpp @@ -86,6 +86,7 @@ namespace Microsoft::Console::VirtualTerminal virtual void NotifyAccessibilityChange(const til::rect& changedRect) = 0; virtual void NotifyBufferRotation(const int delta) = 0; + virtual void NotifyShellIntegrationMark() = 0; virtual void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) = 0; diff --git a/src/terminal/adapter/adaptDispatch.cpp b/src/terminal/adapter/adaptDispatch.cpp index 7f22596c40..2a9801f639 100644 --- a/src/terminal/adapter/adaptDispatch.cpp +++ b/src/terminal/adapter/adaptDispatch.cpp @@ -3594,6 +3594,7 @@ void AdaptDispatch::DoConEmuAction(const std::wstring_view string) else if (subParam == 12) { _pages.ActivePage().Buffer().StartCommand(); + _api.NotifyShellIntegrationMark(); } } @@ -3624,6 +3625,7 @@ void AdaptDispatch::DoITerm2Action(const std::wstring_view string) if (action == L"SetMark") { _pages.ActivePage().Buffer().StartPrompt(); + _api.NotifyShellIntegrationMark(); } } @@ -3657,16 +3659,19 @@ void AdaptDispatch::DoFinalTermAction(const std::wstring_view string) case L'A': // FTCS_PROMPT { _pages.ActivePage().Buffer().StartPrompt(); + _api.NotifyShellIntegrationMark(); break; } case L'B': // FTCS_COMMAND_START { _pages.ActivePage().Buffer().StartCommand(); + _api.NotifyShellIntegrationMark(); break; } case L'C': // FTCS_COMMAND_EXECUTED { _pages.ActivePage().Buffer().StartOutput(); + _api.NotifyShellIntegrationMark(); break; } case L'D': // FTCS_COMMAND_FINISHED @@ -3687,6 +3692,7 @@ void AdaptDispatch::DoFinalTermAction(const std::wstring_view string) } _pages.ActivePage().Buffer().EndCurrentCommand(error); + _api.NotifyShellIntegrationMark(); break; } diff --git a/src/terminal/adapter/ut_adapter/adapterTest.cpp b/src/terminal/adapter/ut_adapter/adapterTest.cpp index a6eecb6b37..5821bb28ae 100644 --- a/src/terminal/adapter/ut_adapter/adapterTest.cpp +++ b/src/terminal/adapter/ut_adapter/adapterTest.cpp @@ -212,6 +212,11 @@ public: Log::Comment(L"NotifyBufferRotation MOCK called..."); } + void NotifyShellIntegrationMark() override + { + Log::Comment(L"NotifyShellIntegrationMark MOCK called..."); + } + void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override { Log::Comment(L"InvokeCompletions MOCK called...");