Skip to content
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

Further refactor and simplify the ConGetSet API #12703

Merged
29 commits merged into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4b8ff8f
Add GetTextBuffer and GetViewport to ConGetSet interface.
j4james Feb 10, 2022
6f5b9d3
Replace most GetConsoleScreenBufferInfoEx usage.
j4james Feb 10, 2022
e449c64
Make more use of GetTextBuffer where possible.
j4james Feb 10, 2022
981075d
Remove unused ConGetSet methods.
j4james Feb 10, 2022
93fee50
Move IL/DL implementation to AdaptDispatch.
j4james Feb 12, 2022
20ab0c4
Reimplement RI in AdaptDispatch.
j4james Feb 12, 2022
6a0744b
Remove unused SCREEN_INFORMATION margin methods.
j4james Feb 12, 2022
177f5ec
Reimplement DECCOLM using ResizeWindow.
j4james Feb 12, 2022
ae439db
Reimplement EraseAll in AdaptDispatch.
j4james Feb 13, 2022
23275ab
Replace SetWindowInfo with SetViewportPosition.
j4james Feb 15, 2022
01df805
Remove SuppressResizeRepaint from ConGetSet.
j4james Feb 15, 2022
dcee135
Reimplement SetInputMode in AdaptDispatch.
j4james Feb 15, 2022
fdd9368
Remove WriteControlInput from ConGetSet.
j4james Feb 15, 2022
9f78c07
Remove ClearBuffer from ConGetSet.
j4james Feb 15, 2022
f1f7bcf
Move Get/SetParserMode to AdaptDispatch.
j4james Feb 16, 2022
51e7b2d
Remove RefreshWindow from ConGetSet.
j4james Feb 17, 2022
05e286c
Reimplement render ops in AdaptDispatch.
j4james Feb 26, 2022
f2869e7
Reimplement SetCursorPosition in AdaptDispatch.
j4james Mar 4, 2022
04ff8e3
Reimplement FillRegion in AdaptDispatch.
j4james Mar 6, 2022
1c151fd
Reimplement ScrollRegion in AdaptDispatch.
j4james Mar 8, 2022
b010012
Standardize margin calculations.
j4james Mar 15, 2022
a1ccfa3
Use til::rect and til::point.
j4james Mar 15, 2022
a9bf059
Get the unit tests working.
j4james Mar 15, 2022
b510caf
Work around audit failures in interactivity classes.
j4james Mar 20, 2022
446002e
Add a helper method to set cursor movement flags.
j4james Apr 10, 2022
64b4a0f
Add missing dependency for adapter unit tests.
j4james Apr 10, 2022
036345f
Pass til::rect by reference.
j4james Apr 13, 2022
79d6a5d
Remove unnecessary IsActiveScreenBuffer test.
j4james Apr 13, 2022
4eb7197
Merge branch 'main' into refactor-congetset-2
j4james Apr 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/cascadia/UnitTests_TerminalCore/ConptyRoundtripTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final

m_state->InitEvents();
m_state->PrepareGlobalFont();
m_state->PrepareGlobalScreenBuffer(TerminalViewWidth, TerminalViewHeight, TerminalViewWidth, TerminalViewHeight);
m_state->PrepareGlobalInputBuffer();
m_state->PrepareGlobalRenderer();
m_state->PrepareGlobalScreenBuffer(TerminalViewWidth, TerminalViewHeight, TerminalViewWidth, TerminalViewHeight);

return true;
}

TEST_CLASS_CLEANUP(ClassCleanup)
{
m_state->CleanupGlobalScreenBuffer();
m_state->CleanupGlobalRenderer();
m_state->CleanupGlobalFont();
m_state->CleanupGlobalInputBuffer();

Expand All @@ -101,8 +103,6 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final
gci.SetFillAttribute(0x07); // DARK_WHITE on DARK_BLACK
gci.CalculateDefaultColorIndices();

g.pRender = new Renderer(gci.GetRenderSettings(), &gci.renderData, nullptr, 0, nullptr);

m_state->PrepareNewTextBufferInfo(true, TerminalViewWidth, TerminalViewHeight);
auto& currentBuffer = gci.GetActiveOutputBuffer();
// Make sure a test hasn't left us in the alt buffer on accident
Expand Down Expand Up @@ -154,8 +154,8 @@ class TerminalCoreUnitTests::ConptyRoundtripTests final
{
m_state->CleanupNewTextBufferInfo();

auto& g = ServiceLocator::LocateGlobals();
delete g.pRender;
auto& engines = ServiceLocator::LocateGlobals().pRender->_engines;
std::fill(engines.begin(), engines.end(), nullptr);

VERIFY_ARE_EQUAL(0u, expectedOutput.size(), L"Tests should drain all the output they push into the expected output buffer.");

Expand Down Expand Up @@ -305,7 +305,8 @@ void ConptyRoundtripTests::_resizeConpty(const unsigned short sx,
void ConptyRoundtripTests::_clearConpty()
{
// Taken verbatim from implementation in PtySignalInputThread::_DoClearBuffer
_pConApi->ClearBuffer();
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
THROW_IF_FAILED(gci.GetActiveOutputBuffer().ClearBuffer());
}

[[nodiscard]] std::tuple<TextBuffer*, TextBuffer*> ConptyRoundtripTests::_performResize(const til::size newSize)
Expand Down
6 changes: 4 additions & 2 deletions src/host/PtySignalInputThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,15 @@ void PtySignalInputThread::_DoResizeWindow(const ResizeWindowData& data)
{
if (_pConApi->ResizeWindow(data.sx, data.sy))
{
_pConApi->SuppressResizeRepaint();
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
THROW_IF_FAILED(gci.GetVtIo()->SuppressResizeRepaint());
}
}

void PtySignalInputThread::_DoClearBuffer()
{
_pConApi->ClearBuffer();
auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
THROW_IF_FAILED(gci.GetActiveOutputBuffer().ClearBuffer());
}

// Method Description:
Expand Down
3 changes: 0 additions & 3 deletions src/host/getset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,6 @@ void ApiRoutines::GetLargestConsoleWindowSizeImpl(const SCREEN_INFORMATION& cont
position.Y < 0));
// clang-format on

// MSFT: 15813316 - Try to use this SetCursorPosition call to inherit the cursor position.
RETURN_IF_FAILED(gci.GetVtIo()->SetCursorPosition(position));

RETURN_IF_NTSTATUS_FAILED(buffer.SetCursorPosition(position, true));

LOG_IF_FAILED(ConsoleImeResizeCompStrView());
Expand Down
Loading