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:
|
||||
// - 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:
|
||||
// - count - the number of lines to modify
|
||||
// - insert - true if inserting lines, false if deleting lines
|
||||
|
@ -2069,6 +2070,10 @@ void DoSrvPrivateModifyLinesImpl(const unsigned int count, const bool insert)
|
|||
screenInfo.GetAttributes());
|
||||
}
|
||||
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));
|
||||
stateMachine.ProcessString(escapeSequence.str());
|
||||
|
||||
Log::Comment(L"Verify cursor didn't move.");
|
||||
VERIFY_ARE_EQUAL(cursorPos, cursor.GetPosition());
|
||||
// The cursor shouldn't move.
|
||||
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.");
|
||||
VERIFY_IS_TRUE(_ValidateLinesContain(0, viewportStart, bufferChar, bufferAttr));
|
||||
|
@ -3749,7 +3757,8 @@ void ScreenBufferTests::InsertLinesInMargins()
|
|||
Log::Comment(NoThrowString().Format(
|
||||
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);
|
||||
{
|
||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||
|
@ -3783,7 +3792,8 @@ void ScreenBufferTests::InsertLinesInMargins()
|
|||
Log::Comment(NoThrowString().Format(
|
||||
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);
|
||||
{
|
||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||
|
@ -3824,7 +3834,8 @@ void ScreenBufferTests::DeleteLinesInMargins()
|
|||
Log::Comment(NoThrowString().Format(
|
||||
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);
|
||||
{
|
||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||
|
@ -3858,7 +3869,8 @@ void ScreenBufferTests::DeleteLinesInMargins()
|
|||
Log::Comment(NoThrowString().Format(
|
||||
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);
|
||||
{
|
||||
auto iter0 = tbi.GetCellDataAt({ 0, 0 });
|
||||
|
|
Loading…
Reference in a new issue