Skip to content

Commit edcd042

Browse files
killerdevildogDHowett
authored andcommitted
Fix scrollbar marks not appearing until scroll or resize (#19185)
This PR resolves an issue where scrollbar marks created by shell integration sequences (OSC 133 FTCS, OSC 1337 iTerm2, and OSC 9;12 ConEmu sequences) were not visible on the scrollbar until the user manually scrolled. The problem was that while marks were being created in the buffer correctly, the UI wasn't being notified to refresh the scrollbar display. The fix adds a new NotifyShellIntegrationMark() method to the ITerminalApi interface that calls _NotifyScrollEvent() to trigger scrollbar refresh, and updates all shell integration sequence handlers in AdaptDispatch to call this notification method after creating marks. This ensures scrollbar marks appear immediately when shell integration sequences are processed, bringing feature parity between auto-detected and shell-integration-based marks. Closes #19104 (cherry picked from commit e818daf) Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgdFukU Service-Version: 1.23
1 parent 99c6de5 commit edcd042

File tree

7 files changed

+25
-0
lines changed

7 files changed

+25
-0
lines changed

src/cascadia/TerminalCore/Terminal.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class Microsoft::Terminal::Core::Terminal final :
155155
bool IsVtInputEnabled() const noexcept override;
156156
void NotifyAccessibilityChange(const til::rect& changedRect) noexcept override;
157157
void NotifyBufferRotation(const int delta) override;
158+
void NotifyShellIntegrationMark() override;
158159

159160
void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override;
160161

src/cascadia/TerminalCore/TerminalApi.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,9 @@ void Terminal::NotifyBufferRotation(const int delta)
404404
_NotifyScrollEvent();
405405
}
406406
}
407+
408+
void Terminal::NotifyShellIntegrationMark()
409+
{
410+
// Notify the scrollbar that marks have been added so it can refresh the mark indicators
411+
_NotifyScrollEvent();
412+
}

src/host/outputStream.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,11 @@ void ConhostInternalGetSet::NotifyBufferRotation(const int delta)
446446
}
447447
}
448448

449+
void ConhostInternalGetSet::NotifyShellIntegrationMark()
450+
{
451+
// Not implemented for conhost - shell integration marks are a Terminal app feature.
452+
}
453+
449454
void ConhostInternalGetSet::InvokeCompletions(std::wstring_view /*menuJson*/, unsigned int /*replaceLength*/)
450455
{
451456
// Not implemented for conhost.

src/host/outputStream.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class ConhostInternalGetSet final : public Microsoft::Console::VirtualTerminal::
6767

6868
void NotifyAccessibilityChange(const til::rect& changedRect) override;
6969
void NotifyBufferRotation(const int delta) override;
70+
void NotifyShellIntegrationMark() override;
7071

7172
void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override;
7273

src/terminal/adapter/ITerminalApi.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace Microsoft::Console::VirtualTerminal
8686

8787
virtual void NotifyAccessibilityChange(const til::rect& changedRect) = 0;
8888
virtual void NotifyBufferRotation(const int delta) = 0;
89+
virtual void NotifyShellIntegrationMark() = 0;
8990

9091
virtual void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) = 0;
9192

src/terminal/adapter/adaptDispatch.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,6 +3594,7 @@ void AdaptDispatch::DoConEmuAction(const std::wstring_view string)
35943594
else if (subParam == 12)
35953595
{
35963596
_pages.ActivePage().Buffer().StartCommand();
3597+
_api.NotifyShellIntegrationMark();
35973598
}
35983599
}
35993600

@@ -3624,6 +3625,7 @@ void AdaptDispatch::DoITerm2Action(const std::wstring_view string)
36243625
if (action == L"SetMark")
36253626
{
36263627
_pages.ActivePage().Buffer().StartPrompt();
3628+
_api.NotifyShellIntegrationMark();
36273629
}
36283630
}
36293631

@@ -3657,16 +3659,19 @@ void AdaptDispatch::DoFinalTermAction(const std::wstring_view string)
36573659
case L'A': // FTCS_PROMPT
36583660
{
36593661
_pages.ActivePage().Buffer().StartPrompt();
3662+
_api.NotifyShellIntegrationMark();
36603663
break;
36613664
}
36623665
case L'B': // FTCS_COMMAND_START
36633666
{
36643667
_pages.ActivePage().Buffer().StartCommand();
3668+
_api.NotifyShellIntegrationMark();
36653669
break;
36663670
}
36673671
case L'C': // FTCS_COMMAND_EXECUTED
36683672
{
36693673
_pages.ActivePage().Buffer().StartOutput();
3674+
_api.NotifyShellIntegrationMark();
36703675
break;
36713676
}
36723677
case L'D': // FTCS_COMMAND_FINISHED
@@ -3687,6 +3692,7 @@ void AdaptDispatch::DoFinalTermAction(const std::wstring_view string)
36873692
}
36883693

36893694
_pages.ActivePage().Buffer().EndCurrentCommand(error);
3695+
_api.NotifyShellIntegrationMark();
36903696

36913697
break;
36923698
}

src/terminal/adapter/ut_adapter/adapterTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ class TestGetSet final : public ITerminalApi
212212
Log::Comment(L"NotifyBufferRotation MOCK called...");
213213
}
214214

215+
void NotifyShellIntegrationMark() override
216+
{
217+
Log::Comment(L"NotifyShellIntegrationMark MOCK called...");
218+
}
219+
215220
void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override
216221
{
217222
Log::Comment(L"InvokeCompletions MOCK called...");

0 commit comments

Comments
 (0)