Move cursor to left margin for IL and DL controls (#2731)
* Move cursor position to the left margin after execution of the IL and DL escape sequences. * Update IL and DL screen buffer tests to account for the cursor moving to the left margin.
This commit is contained in:
parent
537258a60f
commit
1fccbc5304
|
@ -2021,6 +2021,7 @@ void DoSrvPrivateSetDefaultTabStops()
|
||||||
|
|
||||||
// Routine Description:
|
// Routine Description:
|
||||||
// - internal logic for adding or removing lines in the active screen buffer
|
// - internal logic for adding or removing lines in the active screen buffer
|
||||||
|
// this also moves the cursor to the left margin, which is expected behaviour for IL and DL
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - count - the number of lines to modify
|
// - count - the number of lines to modify
|
||||||
// - insert - true if inserting lines, false if deleting lines
|
// - insert - true if inserting lines, false if deleting lines
|
||||||
|
@ -2069,6 +2070,10 @@ void DoSrvPrivateModifyLinesImpl(const unsigned int count, const bool insert)
|
||||||
screenInfo.GetAttributes());
|
screenInfo.GetAttributes());
|
||||||
}
|
}
|
||||||
CATCH_LOG();
|
CATCH_LOG();
|
||||||
|
|
||||||
|
// The IL and DL controls are also expected to move the cursor to the left margin.
|
||||||
|
// For now this is just column 0, since we don't yet support DECSLRM.
|
||||||
|
LOG_IF_NTSTATUS_FAILED(screenInfo.SetCursorPosition({ 0, cursorPosition.Y }, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3230,8 +3230,16 @@ void ScreenBufferTests::ScrollOperations()
|
||||||
VERIFY_SUCCEEDED(si.SetCursorPosition(cursorPos, true));
|
VERIFY_SUCCEEDED(si.SetCursorPosition(cursorPos, true));
|
||||||
stateMachine.ProcessString(escapeSequence.str());
|
stateMachine.ProcessString(escapeSequence.str());
|
||||||
|
|
||||||
Log::Comment(L"Verify cursor didn't move.");
|
// The cursor shouldn't move.
|
||||||
VERIFY_ARE_EQUAL(cursorPos, cursor.GetPosition());
|
auto expectedCursorPos = cursorPos;
|
||||||
|
// Unless this is an IL or DL control, which moves the cursor to the left margin.
|
||||||
|
if (scrollType == InsertLine || scrollType == DeleteLine)
|
||||||
|
{
|
||||||
|
expectedCursorPos.X = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::Comment(L"Verify expected cursor position.");
|
||||||
|
VERIFY_ARE_EQUAL(expectedCursorPos, cursor.GetPosition());
|
||||||
|
|
||||||
Log::Comment(L"Field of Zs outside viewport should remain unchanged.");
|
Log::Comment(L"Field of Zs outside viewport should remain unchanged.");
|
||||||
VERIFY_IS_TRUE(_ValidateLinesContain(0, viewportStart, bufferChar, bufferAttr));
|
VERIFY_IS_TRUE(_ValidateLinesContain(0, viewportStart, bufferChar, bufferAttr));
|
||||||
|
@ -3749,7 +3757,8 @@ void ScreenBufferTests::InsertLinesInMargins()
|
||||||
Log::Comment(NoThrowString().Format(
|
Log::Comment(NoThrowString().Format(
|
||||||
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
||||||
|
|
||||||
VERIFY_ARE_EQUAL(4, cursor.GetPosition().X);
|
// Verify cursor moved to left margin.
|
||||||
|
VERIFY_ARE_EQUAL(0, cursor.GetPosition().X);
|
||||||
VERIFY_ARE_EQUAL(2, cursor.GetPosition().Y);
|
VERIFY_ARE_EQUAL(2, cursor.GetPosition().Y);
|
||||||
{
|
{
|
||||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||||
|
@ -3783,7 +3792,8 @@ void ScreenBufferTests::InsertLinesInMargins()
|
||||||
Log::Comment(NoThrowString().Format(
|
Log::Comment(NoThrowString().Format(
|
||||||
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
||||||
|
|
||||||
VERIFY_ARE_EQUAL(4, cursor.GetPosition().X);
|
// Verify cursor moved to left margin.
|
||||||
|
VERIFY_ARE_EQUAL(0, cursor.GetPosition().X);
|
||||||
VERIFY_ARE_EQUAL(1, cursor.GetPosition().Y);
|
VERIFY_ARE_EQUAL(1, cursor.GetPosition().Y);
|
||||||
{
|
{
|
||||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||||
|
@ -3824,7 +3834,8 @@ void ScreenBufferTests::DeleteLinesInMargins()
|
||||||
Log::Comment(NoThrowString().Format(
|
Log::Comment(NoThrowString().Format(
|
||||||
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
||||||
|
|
||||||
VERIFY_ARE_EQUAL(4, cursor.GetPosition().X);
|
// Verify cursor moved to left margin.
|
||||||
|
VERIFY_ARE_EQUAL(0, cursor.GetPosition().X);
|
||||||
VERIFY_ARE_EQUAL(2, cursor.GetPosition().Y);
|
VERIFY_ARE_EQUAL(2, cursor.GetPosition().Y);
|
||||||
{
|
{
|
||||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||||
|
@ -3858,7 +3869,8 @@ void ScreenBufferTests::DeleteLinesInMargins()
|
||||||
Log::Comment(NoThrowString().Format(
|
Log::Comment(NoThrowString().Format(
|
||||||
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
L"viewport=%s", VerifyOutputTraits<SMALL_RECT>::ToString(si.GetViewport().ToInclusive()).GetBuffer()));
|
||||||
|
|
||||||
VERIFY_ARE_EQUAL(4, cursor.GetPosition().X);
|
// Verify cursor moved to left margin.
|
||||||
|
VERIFY_ARE_EQUAL(0, cursor.GetPosition().X);
|
||||||
VERIFY_ARE_EQUAL(1, cursor.GetPosition().Y);
|
VERIFY_ARE_EQUAL(1, cursor.GetPosition().Y);
|
||||||
{
|
{
|
||||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||||
|
|
Loading…
Reference in a new issue