Skip to content

Commit 877c7c6

Browse files
committed
Address feedback
1 parent 59705d5 commit 877c7c6

File tree

13 files changed

+67
-148
lines changed

13 files changed

+67
-148
lines changed

src/buffer/out/ut_textbuffer/ReflowTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ namespace
604604

605605
extern "C" HRESULT __declspec(dllexport) __cdecl ReflowTestDataSource(IDataSource** ppDataSource, void*)
606606
{
607-
*ppDataSource = new ArrayIndexTaefAdapterSource > (std::size(testCases));
608-
return S_OK;
607+
auto source{ Microsoft::WRL::Make<ArrayIndexTaefAdapterSource>() };
608+
return source.CopyTo(ppDataSource);
609609
}
610610

611611
class ReflowTests

src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
</local:SettingContainer>
5151

5252
<!-- Kitty Keyboard Mode -->
53-
<local:SettingContainer x:Uid="Profile_AllowKittyKeyboardMode"
53+
<local:SettingContainer x:Name="AllowKittyKeyboardMode"
54+
x:Uid="Profile_AllowKittyKeyboardMode"
5455
ClearSettingValue="{x:Bind Profile.ClearAllowKittyKeyboardMode}"
5556
HasSettingValue="{x:Bind Profile.HasAllowKittyKeyboardMode, Mode=OneWay}"
5657
SettingOverrideSource="{x:Bind Profile.AllowKittyKeyboardModeOverrideSource, Mode=OneWay}">

src/cascadia/TerminalSettingsModel/IInheritable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private: \
136136
return std::nullopt; \
137137
} \
138138
\
139-
auto _get##name##OverrideSourceImpl() -> decltype(get_strong()) \
139+
auto _get##name##OverrideSourceImpl()->decltype(get_strong()) \
140140
{ \
141141
/*we have a value*/ \
142142
if (_##name) \
@@ -159,7 +159,7 @@ private: \
159159
} \
160160
\
161161
auto _get##name##OverrideSourceAndValueImpl() \
162-
-> std::pair<decltype(get_strong()), storageType> \
162+
->std::pair<decltype(get_strong()), storageType> \
163163
{ \
164164
/*we have a value*/ \
165165
if (_##name) \

src/host/VtIo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ using namespace Microsoft::Console::Interactivity;
117117
CATCH_RETURN();
118118
}
119119

120-
// TODO: Avoid translating win32im sequences to Kitty Keyboard Protocol temporarily.
120+
// TODO GH#19847: Avoid translating win32im sequences to Kitty Keyboard Protocol temporarily.
121121
// This is because as of this writing, our implementation is brand new, and Windows Terminal
122122
// needs a toggle to disable it. That only works if ConPTY then doesn't do it anyway.
123123
if (const auto inputBuffer = ServiceLocator::LocateGlobals().getConsoleInformation().pInputBuffer)

src/inc/consoletaeftemplates.hpp

Lines changed: 10 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -47,54 +47,14 @@ Revision History:
4747

4848
namespace WEX::TestExecution
4949
{
50-
struct ArrayIndexTaefAdapterRow : IDataRow
50+
struct ArrayIndexTaefAdapterRow : Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataRow>
5151
{
52-
ArrayIndexTaefAdapterRow(size_t index) :
53-
_index(index) {}
54-
55-
// IUnknown
56-
STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject) override
57-
{
58-
if (!ppvObject)
59-
{
60-
return E_POINTER;
61-
}
62-
63-
if (riid == __uuidof(IUnknown))
64-
{
65-
AddRef();
66-
*ppvObject = static_cast<IUnknown*>(this);
67-
return S_OK;
68-
}
69-
else if (riid == __uuidof(IDataRow))
70-
{
71-
*ppvObject = static_cast<IDataRow*>(this);
72-
AddRef();
73-
return S_OK;
74-
}
75-
else
76-
{
77-
*ppvObject = nullptr;
78-
return E_NOINTERFACE;
79-
}
80-
}
81-
82-
ULONG STDMETHODCALLTYPE AddRef() override
83-
{
84-
return _refCount.fetch_add(1) + 1;
85-
}
86-
87-
ULONG STDMETHODCALLTYPE Release() override
52+
HRESULT RuntimeClassInitialize(const size_t index)
8853
{
89-
const auto count = _refCount.fetch_sub(1) - 1;
90-
if (count == 0)
91-
{
92-
delete this;
93-
}
94-
return count;
54+
_index = index;
55+
return S_OK;
9556
}
9657

97-
// IDataRow
9858
STDMETHODIMP GetTestData(BSTR /*pszName*/, SAFEARRAY** ppData) override
9959
{
10060
wchar_t buf[16];
@@ -126,70 +86,28 @@ namespace WEX::TestExecution
12686
}
12787

12888
private:
129-
std::atomic<ULONG> _refCount{ 1 };
13089
size_t _index = 0;
13190
};
13291

133-
struct ArrayIndexTaefAdapterSource : IDataSource
92+
struct ArrayIndexTaefAdapterSource : Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom | Microsoft::WRL::InhibitFtmBase>, IDataSource>
13493
{
135-
explicit ArrayIndexTaefAdapterSource(size_t count) :
136-
_count{ count } {}
137-
138-
// IUnknown
139-
STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject) override
94+
HRESULT RuntimeClassInitialize(const size_t count)
14095
{
141-
if (!ppvObject)
142-
{
143-
return E_POINTER;
144-
}
145-
146-
if (riid == __uuidof(IUnknown))
147-
{
148-
AddRef();
149-
*ppvObject = static_cast<IUnknown*>(this);
150-
return S_OK;
151-
}
152-
else if (riid == __uuidof(IDataSource))
153-
{
154-
*ppvObject = static_cast<IDataSource*>(this);
155-
AddRef();
156-
return S_OK;
157-
}
158-
else
159-
{
160-
*ppvObject = nullptr;
161-
return E_NOINTERFACE;
162-
}
163-
}
164-
165-
ULONG STDMETHODCALLTYPE AddRef() override
166-
{
167-
return _refCount.fetch_add(1) + 1;
168-
}
169-
170-
ULONG STDMETHODCALLTYPE Release() override
171-
{
172-
const auto count = _refCount.fetch_sub(1) - 1;
173-
if (count == 0)
174-
{
175-
delete this;
176-
}
177-
return count;
96+
_count = count;
97+
return S_OK;
17898
}
17999

180-
// IDataSource
181100
STDMETHODIMP Advance(IDataRow** ppDataRow) override
182101
{
183102
if (_index < _count)
184103
{
185-
*ppDataRow = static_cast<IDataRow*>(new ArrayIndexTaefAdapterRow(_index++));
186-
return S_OK;
104+
return Microsoft::WRL::MakeAndInitialize<ArrayIndexTaefAdapterRow>(ppDataRow, _index++);
187105
}
188106
else
189107
{
190108
*ppDataRow = nullptr;
109+
return S_OK;
191110
}
192-
return S_OK;
193111
}
194112

195113
STDMETHODIMP Reset() override
@@ -214,7 +132,6 @@ namespace WEX::TestExecution
214132
}
215133

216134
private:
217-
std::atomic<ULONG> _refCount{ 1 };
218135
size_t _count = 0;
219136
size_t _index = 0;
220137
};

src/interactivity/win32/ut_interactivity_win32/UiaTextRangeTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static constexpr til::point point_offset_by_line(const til::point start, const t
111111

112112
extern "C" HRESULT __declspec(dllexport) __cdecl GeneratedMovementTestDataSource(IDataSource** ppDataSource, void*)
113113
{
114-
*ppDataSource = new ArrayIndexTaefAdapterSource > (std::size(testCases));
115-
return S_OK;
114+
auto source{ Microsoft::WRL::Make<ArrayIndexTaefAdapterSource>() };
115+
return source.CopyTo(ppDataSource);
116116
}
117117

118118
// UiaTextRange takes an object that implements

src/terminal/adapter/ITermDispatch.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch
6767
virtual void DeleteColumn(const VTInt distance) = 0; // DECDC
6868
virtual void SetKeypadMode(const bool applicationMode) = 0; // DECKPAM, DECKPNM
6969
virtual void SetAnsiMode(const bool ansiMode) = 0; // DECANM
70-
virtual void SetKittyKeyboardProtocol(const VTParameter flags, const VTParameter mode) noexcept = 0; // CSI = flags ; mode u
71-
virtual void QueryKittyKeyboardProtocol() = 0; // CSI ? u
72-
virtual void PushKittyKeyboardProtocol(const VTParameter flags) = 0; // CSI > flags u
73-
virtual void PopKittyKeyboardProtocol(const VTParameter count) = 0; // CSI < count u
70+
virtual void SetKittyKeyboardProtocol(const VTParameter flags, const VTParameter mode) noexcept = 0; // KKP
71+
virtual void QueryKittyKeyboardProtocol() = 0; // KKP
72+
virtual void PushKittyKeyboardProtocol(const VTParameter flags) = 0; // KKP
73+
virtual void PopKittyKeyboardProtocol(const VTParameter count) = 0; // KKP
7474
virtual void SetTopBottomScrollingMargins(const VTInt topMargin, const VTInt bottomMargin) = 0; // DECSTBM
7575
virtual void SetLeftRightScrollingMargins(const VTInt leftMargin, const VTInt rightMargin) = 0; // DECSLRM
7676
virtual void EnquireAnswerback() = 0; // ENQ

src/terminal/adapter/adaptDispatch.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ namespace Microsoft::Console::VirtualTerminal
9797
void RequestMode(const DispatchTypes::ModeParams param) override; // DECRQM
9898
void SetKeypadMode(const bool applicationMode) noexcept override; // DECKPAM, DECKPNM
9999
void SetAnsiMode(const bool ansiMode) override; // DECANM
100-
void SetKittyKeyboardProtocol(const VTParameter flags, const VTParameter mode) noexcept override; // Kitty keyboard protocol CSI = flags ; mode u
101-
void QueryKittyKeyboardProtocol() override; // Kitty keyboard protocol CSI ? u
102-
void PushKittyKeyboardProtocol(const VTParameter flags) override; // Kitty keyboard protocol CSI > flags u
103-
void PopKittyKeyboardProtocol(const VTParameter count) override; // Kitty keyboard protocol CSI < count u
100+
void SetKittyKeyboardProtocol(const VTParameter flags, const VTParameter mode) noexcept override; // KKP
101+
void QueryKittyKeyboardProtocol() override; // KKP
102+
void PushKittyKeyboardProtocol(const VTParameter flags) override; // KKP
103+
void PopKittyKeyboardProtocol(const VTParameter count) override; // KKP
104104
void SetTopBottomScrollingMargins(const VTInt topMargin,
105105
const VTInt bottomMargin) override; // DECSTBM
106106
void SetLeftRightScrollingMargins(const VTInt leftMargin,

src/terminal/adapter/termDispatch.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons
5454
void DeleteColumn(const VTInt /*distance*/) override {} // DECDC
5555
void SetKeypadMode(const bool /*applicationMode*/) override {} // DECKPAM, DECKPNM
5656
void SetAnsiMode(const bool /*ansiMode*/) override {} // DECANM
57-
void SetKittyKeyboardProtocol(const VTParameter /*flags*/, const VTParameter /*mode*/) noexcept override {} // CSI = flags ; mode u
58-
void QueryKittyKeyboardProtocol() override {} // CSI ? u
59-
void PushKittyKeyboardProtocol(const VTParameter /*flags*/) override {} // CSI > flags u
60-
void PopKittyKeyboardProtocol(const VTParameter /*count*/) override {} // CSI < count u
57+
void SetKittyKeyboardProtocol(const VTParameter /*flags*/, const VTParameter /*mode*/) noexcept override {} // KKP
58+
void QueryKittyKeyboardProtocol() override {} // KKP
59+
void PushKittyKeyboardProtocol(const VTParameter /*flags*/) override {} // KKP
60+
void PopKittyKeyboardProtocol(const VTParameter /*count*/) override {} // KKP
6161
void SetTopBottomScrollingMargins(const VTInt /*topMargin*/, const VTInt /*bottomMargin*/) override {} // DECSTBM
6262
void SetLeftRightScrollingMargins(const VTInt /*leftMargin*/, const VTInt /*rightMargin*/) override {} // DECSLRM
6363
void EnquireAnswerback() override {} // ENQ

0 commit comments

Comments
 (0)