From 1d75574c6d935ad09d01ef426ad2f81ad09954b7 Mon Sep 17 00:00:00 2001 From: James Holderness Date: Tue, 29 Oct 2019 16:08:44 +0000 Subject: [PATCH 1/2] Add support for the HPA escape sequence as an alias for CHA. --- src/terminal/parser/OutputStateMachineEngine.cpp | 2 ++ src/terminal/parser/OutputStateMachineEngine.hpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/terminal/parser/OutputStateMachineEngine.cpp b/src/terminal/parser/OutputStateMachineEngine.cpp index 66daa8fd23d..795c0ad9e5a 100644 --- a/src/terminal/parser/OutputStateMachineEngine.cpp +++ b/src/terminal/parser/OutputStateMachineEngine.cpp @@ -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: @@ -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; diff --git a/src/terminal/parser/OutputStateMachineEngine.hpp b/src/terminal/parser/OutputStateMachineEngine.hpp index b5ac240a0fa..79bbadc9b9a 100644 --- a/src/terminal/parser/OutputStateMachineEngine.hpp +++ b/src/terminal/parser/OutputStateMachineEngine.hpp @@ -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', From 4d041ade47afce57bd8ea93fc973b51cf5db9cce Mon Sep 17 00:00:00 2001 From: James Holderness Date: Tue, 29 Oct 2019 16:19:29 +0000 Subject: [PATCH 2/2] Extend the output engine tests for cursor movement to confirm that HPA is dispatched in the same way as CHA. --- src/terminal/parser/ut_parser/OutputEngineTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/terminal/parser/ut_parser/OutputEngineTest.cpp b/src/terminal/parser/ut_parser/OutputEngineTest.cpp index 09853d57e4a..4ca923c65b4 100644 --- a/src/terminal/parser/ut_parser/OutputEngineTest.cpp +++ b/src/terminal/parser/ut_parser/OutputEngineTest.cpp @@ -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); @@ -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);