diff --git a/src/host/outputStream.cpp b/src/host/outputStream.cpp index f45fc8b1deb..d87e95dafd0 100644 --- a/src/host/outputStream.cpp +++ b/src/host/outputStream.cpp @@ -299,6 +299,31 @@ BOOL ConhostInternalGetSet::PrivateSetExtendedTextAttributes(const ExtendedAttri return TRUE; } +// Method Description: +// - Retrieves the current TextAttribute of the active screen buffer. +// Arguments: +// - pAttrs: Receives the TextAttribute value. +// Return Value: +// - TRUE if successful. FALSE otherwise. +BOOL ConhostInternalGetSet::PrivateGetTextAttributes(TextAttribute* const pAttrs) const +{ + *pAttrs = _io.GetActiveOutputBuffer().GetAttributes(); + return TRUE; +} + +// Method Description: +// - Sets the current TextAttribute of the active screen buffer. Text +// written to this buffer will be written with these attributes. +// Arguments: +// - attrs: The new TextAttribute to use +// Return Value: +// - TRUE if successful. FALSE otherwise. +BOOL ConhostInternalGetSet::PrivateSetTextAttributes(const TextAttribute& attrs) +{ + _io.GetActiveOutputBuffer().SetAttributes(attrs); + return TRUE; +} + // Routine Description: // - Connects the WriteConsoleInput API call directly into our Driver Message servicing call inside Conhost.exe // Arguments: diff --git a/src/host/outputStream.hpp b/src/host/outputStream.hpp index 5cfb7bf8bbd..3b494f94e0d 100644 --- a/src/host/outputStream.hpp +++ b/src/host/outputStream.hpp @@ -90,6 +90,8 @@ class ConhostInternalGetSet final : public Microsoft::Console::VirtualTerminal:: BOOL PrivateBoldText(const bool bolded) override; BOOL PrivateGetExtendedTextAttributes(ExtendedAttributes* const pAttrs) override; BOOL PrivateSetExtendedTextAttributes(const ExtendedAttributes attrs) override; + BOOL PrivateGetTextAttributes(TextAttribute* const pAttrs) const override; + BOOL PrivateSetTextAttributes(const TextAttribute& attrs) override; BOOL PrivateWriteConsoleInputW(_Inout_ std::deque>& events, _Out_ size_t& eventsWritten) override; diff --git a/src/host/ut_host/ScreenBufferTests.cpp b/src/host/ut_host/ScreenBufferTests.cpp index 3281c08543c..562fab328c0 100644 --- a/src/host/ut_host/ScreenBufferTests.cpp +++ b/src/host/ut_host/ScreenBufferTests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. #include "precomp.h" @@ -193,6 +193,8 @@ class ScreenBufferTests TEST_METHOD(CursorUpDownAcrossMargins); TEST_METHOD(CursorUpDownOutsideMargins); TEST_METHOD(CursorUpDownExactlyAtMargins); + + TEST_METHOD(CursorSaveRestore); }; void ScreenBufferTests::SingleAlternateBufferCreationTest() @@ -5045,3 +5047,121 @@ void ScreenBufferTests::CursorUpDownExactlyAtMargins() stateMachine.ProcessString(L"\x1b[r"); } + +void ScreenBufferTests::CursorSaveRestore() +{ + auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); + auto& si = gci.GetActiveOutputBuffer(); + auto& stateMachine = si.GetStateMachine(); + auto& cursor = si.GetTextBuffer().GetCursor(); + + const auto defaultAttrs = TextAttribute{}; + const auto colorAttrs = TextAttribute{ RGB(12, 34, 56), RGB(78, 90, 12) }; + + const auto asciiText = L"lwkmvj"; + const auto graphicText = L"┌┬┐└┴┘"; + + const auto selectAsciiChars = L"\x1b(B"; + const auto selectGraphicsChars = L"\x1b(0"; + const auto saveCursor = L"\x1b[s"; + const auto restoreCursor = L"\x1b[u"; + const auto setDECOM = L"\x1b[?6h"; + const auto resetDECOM = L"\x1b[?6l"; + + Log::Comment(L"Make sure the viewport is at 0,0"); + VERIFY_SUCCEEDED(si.SetViewportOrigin(true, COORD({ 0, 0 }), true)); + + Log::Comment(L"Restore after save."); + // Set the cursor position, attributes, and character set. + cursor.SetPosition(COORD{ 20, 10 }); + si.SetAttributes(colorAttrs); + stateMachine.ProcessString(selectGraphicsChars); + // Save state. + stateMachine.ProcessString(saveCursor); + // Reset the cursor position, attributes, and character set. + cursor.SetPosition(COORD{ 0, 0 }); + si.SetAttributes(defaultAttrs); + stateMachine.ProcessString(selectAsciiChars); + // Restore state. + stateMachine.ProcessString(restoreCursor); + // Verify initial position, colors, and graphic character set. + VERIFY_ARE_EQUAL(COORD({ 20, 10 }), cursor.GetPosition()); + VERIFY_ARE_EQUAL(colorAttrs, si.GetAttributes()); + stateMachine.ProcessString(asciiText); + VERIFY_IS_TRUE(_ValidateLineContains(COORD({ 20, 10 }), graphicText, colorAttrs)); + + Log::Comment(L"Restore again without save."); + // Reset the cursor position, attributes, and character set. + cursor.SetPosition(COORD{ 0, 0 }); + si.SetAttributes(defaultAttrs); + stateMachine.ProcessString(selectAsciiChars); + // Restore state. + stateMachine.ProcessString(restoreCursor); + // Verify initial saved position, colors, and graphic character set. + VERIFY_ARE_EQUAL(COORD({ 20, 10 }), cursor.GetPosition()); + VERIFY_ARE_EQUAL(colorAttrs, si.GetAttributes()); + stateMachine.ProcessString(asciiText); + VERIFY_IS_TRUE(_ValidateLineContains(COORD({ 20, 10 }), graphicText, colorAttrs)); + + Log::Comment(L"Restore after reset."); + // Soft reset. + stateMachine.ProcessString(L"\x1b[!p"); + // Set the cursor position, attributes, and character set. + cursor.SetPosition(COORD{ 20, 10 }); + si.SetAttributes(colorAttrs); + stateMachine.ProcessString(selectGraphicsChars); + // Restore state. + stateMachine.ProcessString(restoreCursor); + // Verify home position, default attributes, and ascii character set. + VERIFY_ARE_EQUAL(COORD({ 0, 0 }), cursor.GetPosition()); + VERIFY_ARE_EQUAL(defaultAttrs, si.GetAttributes()); + stateMachine.ProcessString(asciiText); + VERIFY_IS_TRUE(_ValidateLineContains(COORD({ 0, 0 }), asciiText, defaultAttrs)); + + Log::Comment(L"Restore origin mode."); + // Set margins and origin mode to relative. + stateMachine.ProcessString(L"\x1b[10;20r"); + stateMachine.ProcessString(setDECOM); + // Verify home position inside margins. + VERIFY_ARE_EQUAL(COORD({ 0, 9 }), cursor.GetPosition()); + // Save state and reset origin mode to absolute. + stateMachine.ProcessString(saveCursor); + stateMachine.ProcessString(resetDECOM); + // Verify home position at origin. + VERIFY_ARE_EQUAL(COORD({ 0, 0 }), cursor.GetPosition()); + // Restore state and move to home position. + stateMachine.ProcessString(restoreCursor); + stateMachine.ProcessString(L"\x1b[H"); + // Verify home position inside margins, i.e. relative origin mode restored. + VERIFY_ARE_EQUAL(COORD({ 0, 9 }), cursor.GetPosition()); + + Log::Comment(L"Clamp inside top margin."); + // Reset margins, with absolute origin, and set cursor position. + stateMachine.ProcessString(L"\x1b[r"); + stateMachine.ProcessString(setDECOM); + cursor.SetPosition(COORD{ 5, 15 }); + // Save state. + stateMachine.ProcessString(saveCursor); + // Set margins and restore state. + stateMachine.ProcessString(L"\x1b[20;25r"); + stateMachine.ProcessString(restoreCursor); + // Verfify Y position is clamped inside the top margin + VERIFY_ARE_EQUAL(COORD({ 5, 19 }), cursor.GetPosition()); + + Log::Comment(L"Clamp inside bottom margin."); + // Reset margins, with absolute origin, and set cursor position. + stateMachine.ProcessString(L"\x1b[r"); + stateMachine.ProcessString(setDECOM); + cursor.SetPosition(COORD{ 5, 15 }); + // Save state. + stateMachine.ProcessString(saveCursor); + // Set margins and restore state. + stateMachine.ProcessString(L"\x1b[1;10r"); + stateMachine.ProcessString(restoreCursor); + // Verfify Y position is clamped inside the top margin + VERIFY_ARE_EQUAL(COORD({ 5, 9 }), cursor.GetPosition()); + + // Reset origin mode and margins. + stateMachine.ProcessString(resetDECOM); + stateMachine.ProcessString(L"\x1b[r"); +} diff --git a/src/terminal/adapter/ITermDispatch.hpp b/src/terminal/adapter/ITermDispatch.hpp index 59b9d749002..a6532832808 100644 --- a/src/terminal/adapter/ITermDispatch.hpp +++ b/src/terminal/adapter/ITermDispatch.hpp @@ -36,8 +36,8 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch virtual bool CursorHorizontalPositionAbsolute(const unsigned int uiColumn) = 0; // CHA virtual bool VerticalLinePositionAbsolute(const unsigned int uiLine) = 0; // VPA virtual bool CursorPosition(const unsigned int uiLine, const unsigned int uiColumn) = 0; // CUP - virtual bool CursorSavePosition() = 0; // DECSC - virtual bool CursorRestorePosition() = 0; // DECRC + virtual bool CursorSaveState() = 0; // DECSC + virtual bool CursorRestoreState() = 0; // DECRC virtual bool CursorVisibility(const bool fIsVisible) = 0; // DECTCEM virtual bool InsertCharacter(const unsigned int uiCount) = 0; // ICH virtual bool DeleteCharacter(const unsigned int uiCount) = 0; // DCH diff --git a/src/terminal/adapter/adaptDispatch.cpp b/src/terminal/adapter/adaptDispatch.cpp index d539eb8c551..546afcf07c7 100644 --- a/src/terminal/adapter/adaptDispatch.cpp +++ b/src/terminal/adapter/adaptDispatch.cpp @@ -27,17 +27,14 @@ AdaptDispatch::AdaptDispatch(ConGetSet* const pConApi, AdaptDefaults* const pDefaults) : _conApi{ THROW_IF_NULL_ALLOC(pConApi) }, _pDefaults{ THROW_IF_NULL_ALLOC(pDefaults) }, + _usingAltBuffer(false), _fIsOriginModeRelative(false), // by default, the DECOM origin mode is absolute. - _fIsSavedOriginModeRelative(false), // as is the origin mode of the saved cursor position. _fIsDECCOLMAllowed(false), // by default, DECCOLM is not allowed. _fChangedBackground(false), _fChangedForeground(false), _fChangedMetaAttrs(false), _TermOutput() { - // The top-left corner in VT-speak is 1,1. Our internal array uses 0 indexes, but VT uses 1,1 for top left corner. - _coordSavedCursor.X = 1; - _coordSavedCursor.Y = 1; _srScrollMargins = { 0 }; // initially, there are no scroll margins. } @@ -415,12 +412,14 @@ bool AdaptDispatch::CursorPosition(_In_ unsigned int const uiLine, _In_ unsigned } // Routine Description: -// - DECSC - Saves the current cursor position into a memory buffer. +// - DECSC - Saves the current "cursor state" into a memory buffer. This +// includes the cursor position, origin mode, graphic rendition, and +// active character set. // Arguments: // - // Return Value: // - True if handled successfully. False otherwise. -bool AdaptDispatch::CursorSavePosition() +bool AdaptDispatch::CursorSaveState() { // First retrieve some information about the buffer CONSOLE_SCREEN_BUFFER_INFOEX csbiex = { 0 }; @@ -429,6 +428,9 @@ bool AdaptDispatch::CursorSavePosition() // before the user scrolled the console output bool fSuccess = !!(_conApi->MoveToBottom() && _conApi->GetConsoleScreenBufferInfoEx(&csbiex)); + TextAttribute attributes; + fSuccess = fSuccess && !!(_conApi->PrivateGetTextAttributes(&attributes)); + if (fSuccess) { // The cursor is given to us by the API as relative to the whole buffer. @@ -438,32 +440,53 @@ bool AdaptDispatch::CursorSavePosition() SMALL_RECT const srViewport = csbiex.srWindow; // VT is also 1 based, not 0 based, so correct by 1. - _coordSavedCursor.X = coordCursor.X - srViewport.Left + 1; - _coordSavedCursor.Y = coordCursor.Y - srViewport.Top + 1; - _fIsSavedOriginModeRelative = _fIsOriginModeRelative; + auto& savedCursorState = _savedCursorState[_usingAltBuffer]; + savedCursorState.Column = coordCursor.X - srViewport.Left + 1; + savedCursorState.Row = coordCursor.Y - srViewport.Top + 1; + savedCursorState.IsOriginModeRelative = _fIsOriginModeRelative; + savedCursorState.Attributes = attributes; + savedCursorState.TermOutput = _TermOutput; } return fSuccess; } // Routine Description: -// - DECRC - Restores a saved cursor position from the DECSC command back into the console state. -// - If no position was set, this defaults to the top left corner (see AdaptDispatch constructor.) +// - DECRC - Restores a saved "cursor state" from the DECSC command back into +// the console state. This includes the cursor position, origin mode, graphic +// rendition, and active character set. // Arguments: // - // Return Value: // - True if handled successfully. False otherwise. -bool AdaptDispatch::CursorRestorePosition() +bool AdaptDispatch::CursorRestoreState() { - unsigned int const uiRow = _coordSavedCursor.Y; - unsigned int const uiCol = _coordSavedCursor.X; + auto& savedCursorState = _savedCursorState[_usingAltBuffer]; + + auto uiRow = savedCursorState.Row; + auto uiCol = savedCursorState.Column; + + // If the origin mode is relative, and the scrolling region is set (the bottom is non-zero), + // we need to make sure the restored position is clamped within the margins. + if (savedCursorState.IsOriginModeRelative && _srScrollMargins.Bottom != 0) + { + // VT origin is at 1,1 so we need to add 1 to these margins. + uiRow = std::clamp(uiRow, _srScrollMargins.Top + 1u, _srScrollMargins.Bottom + 1u); + } // The saved coordinates are always absolute, so we need reset the origin mode temporarily. _fIsOriginModeRelative = false; - bool const fSuccess = _CursorMovePosition(&uiRow, &uiCol); + bool fSuccess = _CursorMovePosition(&uiRow, &uiCol); // Once the cursor position is restored, we can then restore the actual origin mode. - _fIsOriginModeRelative = _fIsSavedOriginModeRelative; + _fIsOriginModeRelative = savedCursorState.IsOriginModeRelative; + + // Restore text attributes. + fSuccess = !!(_conApi->PrivateSetTextAttributes(savedCursorState.Attributes)) && fSuccess; + + // Restore designated character set. + _TermOutput = savedCursorState.TermOutput; + return fSuccess; } @@ -1349,7 +1372,16 @@ bool AdaptDispatch::SetWindowTitle(std::wstring_view title) // - True if handled successfully. False otherwise. bool AdaptDispatch::UseAlternateScreenBuffer() { - return !!_conApi->PrivateUseAlternateScreenBuffer(); + bool fSuccess = CursorSaveState(); + if (fSuccess) + { + fSuccess = !!_conApi->PrivateUseAlternateScreenBuffer(); + if (fSuccess) + { + _usingAltBuffer = true; + } + } + return fSuccess; } // Routine Description: @@ -1361,7 +1393,16 @@ bool AdaptDispatch::UseAlternateScreenBuffer() // - True if handled successfully. False otherwise. bool AdaptDispatch::UseMainScreenBuffer() { - return !!_conApi->PrivateUseMainScreenBuffer(); + bool fSuccess = !!_conApi->PrivateUseMainScreenBuffer(); + if (fSuccess) + { + _usingAltBuffer = false; + if (fSuccess) + { + fSuccess = CursorRestoreState(); + } + } + return fSuccess; } //Routine Description: @@ -1501,9 +1542,11 @@ bool AdaptDispatch::SoftReset() } if (fSuccess) { - // Save cursor state: Home position; Absolute addressing. - _coordSavedCursor = { 1, 1 }; - _fIsSavedOriginModeRelative = false; + // Reset the saved cursor state. + // Note that XTerm only resets the main buffer state, but that + // seems likely to be a bug. Most other terminals reset both. + _savedCursorState[0] = {}; // Main buffer + _savedCursorState[1] = {}; // Alt buffer } return fSuccess; diff --git a/src/terminal/adapter/adaptDispatch.hpp b/src/terminal/adapter/adaptDispatch.hpp index 255dd2c2e6e..3b5284b4cc2 100644 --- a/src/terminal/adapter/adaptDispatch.hpp +++ b/src/terminal/adapter/adaptDispatch.hpp @@ -48,8 +48,8 @@ namespace Microsoft::Console::VirtualTerminal bool CursorHorizontalPositionAbsolute(_In_ unsigned int const uiColumn) override; // CHA bool VerticalLinePositionAbsolute(_In_ unsigned int const uiLine) override; // VPA bool CursorPosition(_In_ unsigned int const uiLine, _In_ unsigned int const uiColumn) override; // CUP - bool CursorSavePosition() override; // DECSC - bool CursorRestorePosition() override; // DECRC + bool CursorSaveState() override; // DECSC + bool CursorRestoreState() override; // DECRC bool CursorVisibility(const bool fIsVisible) override; // DECTCEM bool EraseInDisplay(const DispatchTypes::EraseType eraseType) override; // ED bool EraseInLine(const DispatchTypes::EraseType eraseType) override; // EL @@ -120,6 +120,14 @@ namespace Microsoft::Console::VirtualTerminal Up, Down }; + struct CursorState + { + unsigned int Row = 1; + unsigned int Column = 1; + bool IsOriginModeRelative = false; + TextAttribute Attributes = {}; + TerminalOutput TermOutput = {}; + }; bool _CursorMovement(const CursorDirection dir, _In_ unsigned int const uiDistance) const; bool _CursorMovePosition(_In_opt_ const unsigned int* const puiRow, _In_opt_ const unsigned int* const puiCol) const; @@ -148,11 +156,17 @@ namespace Microsoft::Console::VirtualTerminal std::unique_ptr _pDefaults; TerminalOutput _TermOutput; - COORD _coordSavedCursor; + // We have two instances of the saved cursor state, because we need + // one for the main buffer (at index 0), and another for the alt buffer + // (at index 1). The _usingAltBuffer property keeps tracks of which + // buffer is active, so can be used as an index into this array to + // obtain the saved state that should be currently active. + CursorState _savedCursorState[2]; + bool _usingAltBuffer; + SMALL_RECT _srScrollMargins; bool _fIsOriginModeRelative; - bool _fIsSavedOriginModeRelative; bool _fIsSetColumnsEnabled; diff --git a/src/terminal/adapter/conGetSet.hpp b/src/terminal/adapter/conGetSet.hpp index b337fe2c7d5..3de85753dcb 100644 --- a/src/terminal/adapter/conGetSet.hpp +++ b/src/terminal/adapter/conGetSet.hpp @@ -16,6 +16,7 @@ Author(s): #pragma once #include "..\..\types\inc\IInputEvent.hpp" +#include "..\..\buffer\out\TextAttribute.hpp" #include "..\..\inc\conattrs.hpp" #include @@ -54,6 +55,8 @@ namespace Microsoft::Console::VirtualTerminal virtual BOOL PrivateBoldText(const bool bolded) = 0; virtual BOOL PrivateGetExtendedTextAttributes(ExtendedAttributes* const pAttrs) = 0; virtual BOOL PrivateSetExtendedTextAttributes(const ExtendedAttributes attrs) = 0; + virtual BOOL PrivateGetTextAttributes(TextAttribute* const pAttrs) const = 0; + virtual BOOL PrivateSetTextAttributes(const TextAttribute& attrs) = 0; virtual BOOL PrivateWriteConsoleInputW(_Inout_ std::deque>& events, _Out_ size_t& eventsWritten) = 0; diff --git a/src/terminal/adapter/termDispatch.hpp b/src/terminal/adapter/termDispatch.hpp index 8fb7bce9161..a18a5fed9f0 100644 --- a/src/terminal/adapter/termDispatch.hpp +++ b/src/terminal/adapter/termDispatch.hpp @@ -33,8 +33,8 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons bool CursorHorizontalPositionAbsolute(const unsigned int /*uiColumn*/) override { return false; } // CHA bool VerticalLinePositionAbsolute(const unsigned int /*uiLine*/) override { return false; } // VPA bool CursorPosition(const unsigned int /*uiLine*/, const unsigned int /*uiColumn*/) override { return false; } // CUP - bool CursorSavePosition() override { return false; } // DECSC - bool CursorRestorePosition() override { return false; } // DECRC + bool CursorSaveState() override { return false; } // DECSC + bool CursorRestoreState() override { return false; } // DECRC bool CursorVisibility(const bool /*fIsVisible*/) override { return false; } // DECTCEM bool InsertCharacter(const unsigned int /*uiCount*/) override { return false; } // ICH bool DeleteCharacter(const unsigned int /*uiCount*/) override { return false; } // DCH diff --git a/src/terminal/adapter/ut_adapter/adapterTest.cpp b/src/terminal/adapter/ut_adapter/adapterTest.cpp index 09258aca34b..7b5fd7eee05 100644 --- a/src/terminal/adapter/ut_adapter/adapterTest.cpp +++ b/src/terminal/adapter/ut_adapter/adapterTest.cpp @@ -351,6 +351,18 @@ class TestGetSet final : public ConGetSet return true; } + BOOL PrivateGetTextAttributes(TextAttribute* const /*pAttrs*/) const + { + Log::Comment(L"PrivateGetTextAttributes MOCK called..."); + return true; + } + + BOOL PrivateSetTextAttributes(const TextAttribute& /*attrs*/) + { + Log::Comment(L"PrivateSetTextAttributes MOCK called..."); + return true; + } + BOOL PrivateWriteConsoleInputW(_Inout_ std::deque>& events, _Out_ size_t& eventsWritten) override { @@ -1605,11 +1617,11 @@ class AdapterTest _testGetSet->PrepData(CursorX::XCENTER, CursorY::YCENTER); _testGetSet->_coordExpectedCursorPos = coordExpected; - VERIFY_IS_TRUE(_pDispatch->CursorRestorePosition(), L"By default, restore to top left corner (0,0 offset from viewport)."); + VERIFY_IS_TRUE(_pDispatch->CursorRestoreState(), L"By default, restore to top left corner (0,0 offset from viewport)."); Log::Comment(L"Test 2: Place cursor in center. Save. Move cursor to corner. Restore. Should come back to center."); _testGetSet->PrepData(CursorX::XCENTER, CursorY::YCENTER); - VERIFY_IS_TRUE(_pDispatch->CursorSavePosition(), L"Succeed at saving position."); + VERIFY_IS_TRUE(_pDispatch->CursorSaveState(), L"Succeed at saving position."); Log::Comment(L"Backup expected cursor (in the middle). Move cursor to corner. Then re-set expected cursor to middle."); // save expected cursor position @@ -1621,7 +1633,7 @@ class AdapterTest // restore expected cursor position to center. _testGetSet->_coordExpectedCursorPos = coordExpected; - VERIFY_IS_TRUE(_pDispatch->CursorRestorePosition(), L"Restoring to corner should succeed. API call inside will test that cursor matched expected position."); + VERIFY_IS_TRUE(_pDispatch->CursorRestoreState(), L"Restoring to corner should succeed. API call inside will test that cursor matched expected position."); } TEST_METHOD(CursorHideShowTest) diff --git a/src/terminal/parser/OutputStateMachineEngine.cpp b/src/terminal/parser/OutputStateMachineEngine.cpp index 66daa8fd23d..b22b1531e25 100644 --- a/src/terminal/parser/OutputStateMachineEngine.cpp +++ b/src/terminal/parser/OutputStateMachineEngine.cpp @@ -194,11 +194,11 @@ bool OutputStateMachineEngine::ActionEscDispatch(const wchar_t wch, TermTelemetry::Instance().Log(TermTelemetry::Codes::CUB); break; case VTActionCodes::DECSC_CursorSave: - fSuccess = _dispatch->CursorSavePosition(); + fSuccess = _dispatch->CursorSaveState(); TermTelemetry::Instance().Log(TermTelemetry::Codes::DECSC); break; case VTActionCodes::DECRC_CursorRestore: - fSuccess = _dispatch->CursorRestorePosition(); + fSuccess = _dispatch->CursorRestoreState(); TermTelemetry::Instance().Log(TermTelemetry::Codes::DECRC); break; case VTActionCodes::DECKPAM_KeypadApplicationMode: @@ -452,11 +452,11 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const wchar_t wch, TermTelemetry::Instance().Log(TermTelemetry::Codes::SD); break; case VTActionCodes::ANSISYSSC_CursorSave: - fSuccess = _dispatch->CursorSavePosition(); + fSuccess = _dispatch->CursorSaveState(); TermTelemetry::Instance().Log(TermTelemetry::Codes::ANSISYSSC); break; case VTActionCodes::ANSISYSRC_CursorRestore: - fSuccess = _dispatch->CursorRestorePosition(); + fSuccess = _dispatch->CursorRestoreState(); TermTelemetry::Instance().Log(TermTelemetry::Codes::ANSISYSRC); break; case VTActionCodes::IL_InsertLine: diff --git a/src/terminal/parser/ut_parser/OutputEngineTest.cpp b/src/terminal/parser/ut_parser/OutputEngineTest.cpp index 09853d57e4a..fcc5af3fabb 100644 --- a/src/terminal/parser/ut_parser/OutputEngineTest.cpp +++ b/src/terminal/parser/ut_parser/OutputEngineTest.cpp @@ -718,13 +718,13 @@ class StatefulDispatch final : public TermDispatch return true; } - bool CursorSavePosition() override + bool CursorSaveState() override { _fCursorSave = true; return true; } - bool CursorRestorePosition() override + bool CursorRestoreState() override { _fCursorLoad = true; return true;