Skip to content

Commit

Permalink
Add support for the HPA escape sequence (#3368)
Browse files Browse the repository at this point in the history
* Add support for the HPA escape sequence as an alias for CHA.

* Extend the output engine tests for cursor movement to confirm that HPA is dispatched in the same way as CHA.
  • Loading branch information
j4james authored and zadjii-msft committed Oct 31, 2019
1 parent 891b34d commit 46ac191
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/terminal/parser/OutputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const wchar_t wch,
case VTActionCodes::CNL_CursorNextLine:
case VTActionCodes::CPL_CursorPrevLine:
case VTActionCodes::CHA_CursorHorizontalAbsolute:
case VTActionCodes::HPA_HorizontalPositionAbsolute:
case VTActionCodes::VPA_VerticalLinePositionAbsolute:
case VTActionCodes::ICH_InsertCharacter:
case VTActionCodes::DCH_DeleteCharacter:
Expand Down Expand Up @@ -399,6 +400,7 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const wchar_t wch,
TermTelemetry::Instance().Log(TermTelemetry::Codes::CPL);
break;
case VTActionCodes::CHA_CursorHorizontalAbsolute:
case VTActionCodes::HPA_HorizontalPositionAbsolute:
fSuccess = _dispatch->CursorHorizontalPositionAbsolute(uiDistance);
TermTelemetry::Instance().Log(TermTelemetry::Codes::CHA);
break;
Expand Down
1 change: 1 addition & 0 deletions src/terminal/parser/OutputStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ namespace Microsoft::Console::VirtualTerminal
DECSCPP_SetColumnsPerPage = L'|',
IL_InsertLine = L'L',
DL_DeleteLine = L'M', // Yes, this is the same as RI, however, RI is not preceeded by a CSI, and DL is.
HPA_HorizontalPositionAbsolute = L'`',
VPA_VerticalLinePositionAbsolute = L'd',
DECSTBM_SetScrollingRegion = L'r',
RI_ReverseLineFeed = L'M',
Expand Down
4 changes: 4 additions & 0 deletions src/terminal/parser/ut_parser/OutputEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,8 @@ class StateMachineExternalTest final
pDispatch->ClearState();
TestCsiCursorMovement(L'G', uiDistance, true, &pDispatch->_fCursorHorizontalPositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'`', uiDistance, true, &pDispatch->_fCursorHorizontalPositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'd', uiDistance, true, &pDispatch->_fVerticalLinePositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'@', uiDistance, true, &pDispatch->_fInsertCharacter, mach, *pDispatch);
Expand Down Expand Up @@ -1082,6 +1084,8 @@ class StateMachineExternalTest final
pDispatch->ClearState();
TestCsiCursorMovement(L'G', uiDistance, false, &pDispatch->_fCursorHorizontalPositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'`', uiDistance, false, &pDispatch->_fCursorHorizontalPositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'd', uiDistance, false, &pDispatch->_fVerticalLinePositionAbsolute, mach, *pDispatch);
pDispatch->ClearState();
TestCsiCursorMovement(L'@', uiDistance, false, &pDispatch->_fInsertCharacter, mach, *pDispatch);
Expand Down

0 comments on commit 46ac191

Please sign in to comment.