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

Ensure reading the buffer content actually returns the content #14379

Merged
1 commit merged into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto strEnd = rowText.find_last_not_of(UNICODE_SPACE);
if (strEnd != decltype(rowText)::npos)
{
str.append(rowText.substr(strEnd + 1));
str.append(rowText.substr(0, strEnd + 1));
}

if (!row.WasWrapForced())
Expand Down
19 changes: 19 additions & 0 deletions src/cascadia/UnitTests_Control/ControlCoreTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace ControlUnitTests
TEST_METHOD(TestClearScrollback);
TEST_METHOD(TestClearScreen);
TEST_METHOD(TestClearAll);
TEST_METHOD(TestReadEntireBuffer);

TEST_CLASS_SETUP(ModuleSetup)
{
Expand Down Expand Up @@ -340,4 +341,22 @@ namespace ControlUnitTests
// The ConptyRoundtripTests test the actual clearing of the contents.
}

void ControlCoreTests::TestReadEntireBuffer()
{
auto [settings, conn] = _createSettingsAndConnection();
Log::Comment(L"Create ControlCore object");
auto core = createCore(*settings, *conn);
VERIFY_IS_NOT_NULL(core);
_standardInit(core);

Log::Comment(L"Print some text");
conn->WriteInput(L"This is some text \r\n");
conn->WriteInput(L"with varying amounts \r\n");
conn->WriteInput(L"of whitespace \r\n");

Log::Comment(L"Check the buffer contents");
VERIFY_ARE_EQUAL(L"This is some text\r\nwith varying amounts\r\nof whitespace\r\n",
core->ReadEntireBuffer());
}

}