mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-11 04:38:24 -06:00
ConPTY: Flush unhandled sequences to the buffer (#17741)
#17510 made it so that VT requests like DA1 are passed through to the hosting terminal and so conhost stopped responding to them on its own. But since our input parser doesn't support proper passthrough (yet), it swallowed the response coming from the terminal. To solve this issue, this PR repurposes the existing boolean return values to indicate to the parser whether the current sequence should be flushed to the dispatcher as-is. The output parser always returns true (success) and leaves its pass-through handler empty, while the input parser returns false for sequences it doesn't expect. ## Validation Steps Performed * Launch cmd * Press `Ctrl+[`, `[`, `c`, `Enter` (= `^[[c` = DA1 request) * DA1 response is visible ✅
This commit is contained in:
parent
cbb4a0a01c
commit
6dd9c468eb
@ -28,10 +28,6 @@ VtInputThread::VtInputThread(_In_ wil::unique_hfile hPipe, const bool inheritCur
|
||||
|
||||
auto dispatch = std::make_unique<InteractDispatch>();
|
||||
auto engine = std::make_unique<InputStateMachineEngine>(std::move(dispatch), inheritCursor);
|
||||
|
||||
// we need this callback to be able to flush an unknown input sequence to the app
|
||||
engine->SetFlushToInputQueueCallback([this] { return _pInputStateMachine->FlushToTerminal(); });
|
||||
|
||||
_pInputStateMachine = std::make_unique<StateMachine>(std::move(engine));
|
||||
}
|
||||
|
||||
|
||||
@ -96,19 +96,6 @@ namespace til // Terminal Implementation Library. Also: "Today I Learned"
|
||||
|
||||
// These sit outside the namespace because they sit outside for WIL too.
|
||||
|
||||
// Inspired from RETURN_IF_WIN32_BOOL_FALSE
|
||||
// WIL doesn't include a RETURN_BOOL_IF_FALSE, and RETURN_IF_WIN32_BOOL_FALSE
|
||||
// will actually return the value of GLE.
|
||||
#define RETURN_BOOL_IF_FALSE(b) \
|
||||
do \
|
||||
{ \
|
||||
const bool __boolRet = wil::verify_bool(b); \
|
||||
if (!__boolRet) \
|
||||
{ \
|
||||
return __boolRet; \
|
||||
} \
|
||||
} while (0, 0)
|
||||
|
||||
// Due to a bug (DevDiv 441931), Warning 4297 (function marked noexcept throws
|
||||
// exception) is detected even when the throwing code is unreachable, such as
|
||||
// the end of scope after a return, in function-level catch.
|
||||
|
||||
@ -280,7 +280,7 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool for_each(const T&& predicate) const
|
||||
void for_each(const T&& predicate) const
|
||||
{
|
||||
auto params = _params;
|
||||
|
||||
@ -291,12 +291,10 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
params = defaultParameters;
|
||||
}
|
||||
|
||||
auto success = true;
|
||||
for (const auto& v : params)
|
||||
{
|
||||
success = predicate(v) && success;
|
||||
predicate(v);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -198,7 +198,10 @@ void FontBuffer::AddSixelData(const wchar_t ch)
|
||||
bool FontBuffer::FinalizeSixelData()
|
||||
{
|
||||
// If the charset ID hasn't been initialized this isn't a valid update.
|
||||
RETURN_BOOL_IF_FALSE(_charsetIdInitialized);
|
||||
if (!_charsetIdInitialized)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Flush the current line to make sure we take all the used positions
|
||||
// into account when calculating the font dimensions.
|
||||
|
||||
@ -28,21 +28,13 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
virtual ~IInteractDispatch() = default;
|
||||
#pragma warning(pop)
|
||||
|
||||
virtual bool WriteInput(const std::span<const INPUT_RECORD>& inputEvents) = 0;
|
||||
|
||||
virtual bool WriteCtrlKey(const INPUT_RECORD& event) = 0;
|
||||
|
||||
virtual bool WriteString(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2) = 0;
|
||||
|
||||
virtual bool MoveCursor(const VTInt row,
|
||||
const VTInt col) = 0;
|
||||
|
||||
virtual bool IsVtInputEnabled() const = 0;
|
||||
|
||||
virtual bool FocusChanged(const bool focused) const = 0;
|
||||
virtual void WriteInput(const std::span<const INPUT_RECORD>& inputEvents) = 0;
|
||||
virtual void WriteCtrlKey(const INPUT_RECORD& event) = 0;
|
||||
virtual void WriteString(std::wstring_view string) = 0;
|
||||
virtual void WindowManipulation(DispatchTypes::WindowManipulationType function, VTParameter parameter1, VTParameter parameter2) = 0;
|
||||
virtual void MoveCursor(VTInt row, VTInt col) = 0;
|
||||
virtual void FocusChanged(bool focused) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
@ -32,123 +32,123 @@ public:
|
||||
virtual void Print(const wchar_t wchPrintable) = 0;
|
||||
virtual void PrintString(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool CursorUp(const VTInt distance) = 0; // CUU
|
||||
virtual bool CursorDown(const VTInt distance) = 0; // CUD
|
||||
virtual bool CursorForward(const VTInt distance) = 0; // CUF
|
||||
virtual bool CursorBackward(const VTInt distance) = 0; // CUB, BS
|
||||
virtual bool CursorNextLine(const VTInt distance) = 0; // CNL
|
||||
virtual bool CursorPrevLine(const VTInt distance) = 0; // CPL
|
||||
virtual bool CursorHorizontalPositionAbsolute(const VTInt column) = 0; // HPA, CHA
|
||||
virtual bool VerticalLinePositionAbsolute(const VTInt line) = 0; // VPA
|
||||
virtual bool HorizontalPositionRelative(const VTInt distance) = 0; // HPR
|
||||
virtual bool VerticalPositionRelative(const VTInt distance) = 0; // VPR
|
||||
virtual bool CursorPosition(const VTInt line, const VTInt column) = 0; // CUP, HVP
|
||||
virtual bool CursorSaveState() = 0; // DECSC
|
||||
virtual bool CursorRestoreState() = 0; // DECRC
|
||||
virtual bool InsertCharacter(const VTInt count) = 0; // ICH
|
||||
virtual bool DeleteCharacter(const VTInt count) = 0; // DCH
|
||||
virtual bool ScrollUp(const VTInt distance) = 0; // SU
|
||||
virtual bool ScrollDown(const VTInt distance) = 0; // SD
|
||||
virtual bool NextPage(const VTInt pageCount) = 0; // NP
|
||||
virtual bool PrecedingPage(const VTInt pageCount) = 0; // PP
|
||||
virtual bool PagePositionAbsolute(const VTInt page) = 0; // PPA
|
||||
virtual bool PagePositionRelative(const VTInt pageCount) = 0; // PPR
|
||||
virtual bool PagePositionBack(const VTInt pageCount) = 0; // PPB
|
||||
virtual bool RequestDisplayedExtent() = 0; // DECRQDE
|
||||
virtual bool InsertLine(const VTInt distance) = 0; // IL
|
||||
virtual bool DeleteLine(const VTInt distance) = 0; // DL
|
||||
virtual bool InsertColumn(const VTInt distance) = 0; // DECIC
|
||||
virtual bool DeleteColumn(const VTInt distance) = 0; // DECDC
|
||||
virtual bool SetKeypadMode(const bool applicationMode) = 0; // DECKPAM, DECKPNM
|
||||
virtual bool SetAnsiMode(const bool ansiMode) = 0; // DECANM
|
||||
virtual bool SetTopBottomScrollingMargins(const VTInt topMargin, const VTInt bottomMargin) = 0; // DECSTBM
|
||||
virtual bool SetLeftRightScrollingMargins(const VTInt leftMargin, const VTInt rightMargin) = 0; // DECSLRM
|
||||
virtual bool EnquireAnswerback() = 0; // ENQ
|
||||
virtual bool WarningBell() = 0; // BEL
|
||||
virtual bool CarriageReturn() = 0; // CR
|
||||
virtual bool LineFeed(const DispatchTypes::LineFeedType lineFeedType) = 0; // IND, NEL, LF, FF, VT
|
||||
virtual bool ReverseLineFeed() = 0; // RI
|
||||
virtual bool BackIndex() = 0; // DECBI
|
||||
virtual bool ForwardIndex() = 0; // DECFI
|
||||
virtual bool SetWindowTitle(std::wstring_view title) = 0; // DECSWT, OscWindowTitle
|
||||
virtual bool HorizontalTabSet() = 0; // HTS
|
||||
virtual bool ForwardTab(const VTInt numTabs) = 0; // CHT, HT
|
||||
virtual bool BackwardsTab(const VTInt numTabs) = 0; // CBT
|
||||
virtual bool TabClear(const DispatchTypes::TabClearType clearType) = 0; // TBC
|
||||
virtual bool TabSet(const VTParameter setType) = 0; // DECST8C
|
||||
virtual bool SetColorTableEntry(const size_t tableIndex, const DWORD color) = 0; // OSCSetColorTable
|
||||
virtual bool RequestColorTableEntry(const size_t tableIndex) = 0; // OSCGetColorTable
|
||||
virtual bool SetXtermColorResource(const size_t resource, const DWORD color) = 0; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
virtual bool RequestXtermColorResource(const size_t resource) = 0; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
virtual bool AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) = 0; // DECAC
|
||||
virtual void CursorUp(const VTInt distance) = 0; // CUU
|
||||
virtual void CursorDown(const VTInt distance) = 0; // CUD
|
||||
virtual void CursorForward(const VTInt distance) = 0; // CUF
|
||||
virtual void CursorBackward(const VTInt distance) = 0; // CUB, BS
|
||||
virtual void CursorNextLine(const VTInt distance) = 0; // CNL
|
||||
virtual void CursorPrevLine(const VTInt distance) = 0; // CPL
|
||||
virtual void CursorHorizontalPositionAbsolute(const VTInt column) = 0; // HPA, CHA
|
||||
virtual void VerticalLinePositionAbsolute(const VTInt line) = 0; // VPA
|
||||
virtual void HorizontalPositionRelative(const VTInt distance) = 0; // HPR
|
||||
virtual void VerticalPositionRelative(const VTInt distance) = 0; // VPR
|
||||
virtual void CursorPosition(const VTInt line, const VTInt column) = 0; // CUP, HVP
|
||||
virtual void CursorSaveState() = 0; // DECSC
|
||||
virtual void CursorRestoreState() = 0; // DECRC
|
||||
virtual void InsertCharacter(const VTInt count) = 0; // ICH
|
||||
virtual void DeleteCharacter(const VTInt count) = 0; // DCH
|
||||
virtual void ScrollUp(const VTInt distance) = 0; // SU
|
||||
virtual void ScrollDown(const VTInt distance) = 0; // SD
|
||||
virtual void NextPage(const VTInt pageCount) = 0; // NP
|
||||
virtual void PrecedingPage(const VTInt pageCount) = 0; // PP
|
||||
virtual void PagePositionAbsolute(const VTInt page) = 0; // PPA
|
||||
virtual void PagePositionRelative(const VTInt pageCount) = 0; // PPR
|
||||
virtual void PagePositionBack(const VTInt pageCount) = 0; // PPB
|
||||
virtual void RequestDisplayedExtent() = 0; // DECRQDE
|
||||
virtual void InsertLine(const VTInt distance) = 0; // IL
|
||||
virtual void DeleteLine(const VTInt distance) = 0; // DL
|
||||
virtual void InsertColumn(const VTInt distance) = 0; // DECIC
|
||||
virtual void DeleteColumn(const VTInt distance) = 0; // DECDC
|
||||
virtual void SetKeypadMode(const bool applicationMode) = 0; // DECKPAM, DECKPNM
|
||||
virtual void SetAnsiMode(const bool ansiMode) = 0; // DECANM
|
||||
virtual void SetTopBottomScrollingMargins(const VTInt topMargin, const VTInt bottomMargin) = 0; // DECSTBM
|
||||
virtual void SetLeftRightScrollingMargins(const VTInt leftMargin, const VTInt rightMargin) = 0; // DECSLRM
|
||||
virtual void EnquireAnswerback() = 0; // ENQ
|
||||
virtual void WarningBell() = 0; // BEL
|
||||
virtual void CarriageReturn() = 0; // CR
|
||||
virtual void LineFeed(const DispatchTypes::LineFeedType lineFeedType) = 0; // IND, NEL, LF, FF, VT
|
||||
virtual void ReverseLineFeed() = 0; // RI
|
||||
virtual void BackIndex() = 0; // DECBI
|
||||
virtual void ForwardIndex() = 0; // DECFI
|
||||
virtual void SetWindowTitle(std::wstring_view title) = 0; // DECSWT, OscWindowTitle
|
||||
virtual void HorizontalTabSet() = 0; // HTS
|
||||
virtual void ForwardTab(const VTInt numTabs) = 0; // CHT, HT
|
||||
virtual void BackwardsTab(const VTInt numTabs) = 0; // CBT
|
||||
virtual void TabClear(const DispatchTypes::TabClearType clearType) = 0; // TBC
|
||||
virtual void TabSet(const VTParameter setType) = 0; // DECST8C
|
||||
virtual void SetColorTableEntry(const size_t tableIndex, const DWORD color) = 0; // OSCSetColorTable
|
||||
virtual void RequestColorTableEntry(const size_t tableIndex) = 0; // OSCGetColorTable
|
||||
virtual void SetXtermColorResource(const size_t resource, const DWORD color) = 0; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
virtual void RequestXtermColorResource(const size_t resource) = 0; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
virtual void AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) = 0; // DECAC
|
||||
|
||||
virtual bool EraseInDisplay(const DispatchTypes::EraseType eraseType) = 0; // ED
|
||||
virtual bool EraseInLine(const DispatchTypes::EraseType eraseType) = 0; // EL
|
||||
virtual bool EraseCharacters(const VTInt numChars) = 0; // ECH
|
||||
virtual bool SelectiveEraseInDisplay(const DispatchTypes::EraseType eraseType) = 0; // DECSED
|
||||
virtual bool SelectiveEraseInLine(const DispatchTypes::EraseType eraseType) = 0; // DECSEL
|
||||
virtual void EraseInDisplay(const DispatchTypes::EraseType eraseType) = 0; // ED
|
||||
virtual void EraseInLine(const DispatchTypes::EraseType eraseType) = 0; // EL
|
||||
virtual void EraseCharacters(const VTInt numChars) = 0; // ECH
|
||||
virtual void SelectiveEraseInDisplay(const DispatchTypes::EraseType eraseType) = 0; // DECSED
|
||||
virtual void SelectiveEraseInLine(const DispatchTypes::EraseType eraseType) = 0; // DECSEL
|
||||
|
||||
virtual bool ChangeAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) = 0; // DECCARA
|
||||
virtual bool ReverseAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) = 0; // DECRARA
|
||||
virtual bool CopyRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTInt page, const VTInt dstTop, const VTInt dstLeft, const VTInt dstPage) = 0; // DECCRA
|
||||
virtual bool FillRectangularArea(const VTParameter ch, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECFRA
|
||||
virtual bool EraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECERA
|
||||
virtual bool SelectiveEraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECSERA
|
||||
virtual bool SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent changeExtent) = 0; // DECSACE
|
||||
virtual bool RequestChecksumRectangularArea(const VTInt id, const VTInt page, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECRQCRA
|
||||
virtual void ChangeAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) = 0; // DECCARA
|
||||
virtual void ReverseAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) = 0; // DECRARA
|
||||
virtual void CopyRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTInt page, const VTInt dstTop, const VTInt dstLeft, const VTInt dstPage) = 0; // DECCRA
|
||||
virtual void FillRectangularArea(const VTParameter ch, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECFRA
|
||||
virtual void EraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECERA
|
||||
virtual void SelectiveEraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECSERA
|
||||
virtual void SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent changeExtent) = 0; // DECSACE
|
||||
virtual void RequestChecksumRectangularArea(const VTInt id, const VTInt page, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) = 0; // DECRQCRA
|
||||
|
||||
virtual bool SetGraphicsRendition(const VTParameters options) = 0; // SGR
|
||||
virtual bool SetLineRendition(const LineRendition rendition) = 0; // DECSWL, DECDWL, DECDHL
|
||||
virtual bool SetCharacterProtectionAttribute(const VTParameters options) = 0; // DECSCA
|
||||
virtual void SetGraphicsRendition(const VTParameters options) = 0; // SGR
|
||||
virtual void SetLineRendition(const LineRendition rendition) = 0; // DECSWL, DECDWL, DECDHL
|
||||
virtual void SetCharacterProtectionAttribute(const VTParameters options) = 0; // DECSCA
|
||||
|
||||
virtual bool PushGraphicsRendition(const VTParameters options) = 0; // XTPUSHSGR
|
||||
virtual bool PopGraphicsRendition() = 0; // XTPOPSGR
|
||||
virtual void PushGraphicsRendition(const VTParameters options) = 0; // XTPUSHSGR
|
||||
virtual void PopGraphicsRendition() = 0; // XTPOPSGR
|
||||
|
||||
virtual bool SetMode(const DispatchTypes::ModeParams param) = 0; // SM, DECSET
|
||||
virtual bool ResetMode(const DispatchTypes::ModeParams param) = 0; // RM, DECRST
|
||||
virtual bool RequestMode(const DispatchTypes::ModeParams param) = 0; // DECRQM
|
||||
virtual void SetMode(const DispatchTypes::ModeParams param) = 0; // SM, DECSET
|
||||
virtual void ResetMode(const DispatchTypes::ModeParams param) = 0; // RM, DECRST
|
||||
virtual void RequestMode(const DispatchTypes::ModeParams param) = 0; // DECRQM
|
||||
|
||||
virtual bool DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter id) = 0; // DSR
|
||||
virtual bool DeviceAttributes() = 0; // DA1
|
||||
virtual bool SecondaryDeviceAttributes() = 0; // DA2
|
||||
virtual bool TertiaryDeviceAttributes() = 0; // DA3
|
||||
virtual bool Vt52DeviceAttributes() = 0; // VT52 Identify
|
||||
virtual bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) = 0; // DECREQTPARM
|
||||
virtual void DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter id) = 0; // DSR
|
||||
virtual void DeviceAttributes() = 0; // DA1
|
||||
virtual void SecondaryDeviceAttributes() = 0; // DA2
|
||||
virtual void TertiaryDeviceAttributes() = 0; // DA3
|
||||
virtual void Vt52DeviceAttributes() = 0; // VT52 Identify
|
||||
virtual void RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) = 0; // DECREQTPARM
|
||||
|
||||
virtual bool DesignateCodingSystem(const VTID codingSystem) = 0; // DOCS
|
||||
virtual bool Designate94Charset(const VTInt gsetNumber, const VTID charset) = 0; // SCS
|
||||
virtual bool Designate96Charset(const VTInt gsetNumber, const VTID charset) = 0; // SCS
|
||||
virtual bool LockingShift(const VTInt gsetNumber) = 0; // LS0, LS1, LS2, LS3
|
||||
virtual bool LockingShiftRight(const VTInt gsetNumber) = 0; // LS1R, LS2R, LS3R
|
||||
virtual bool SingleShift(const VTInt gsetNumber) = 0; // SS2, SS3
|
||||
virtual bool AcceptC1Controls(const bool enabled) = 0; // DECAC1
|
||||
virtual bool AnnounceCodeStructure(const VTInt ansiLevel) = 0; // ACS
|
||||
virtual void DesignateCodingSystem(const VTID codingSystem) = 0; // DOCS
|
||||
virtual void Designate94Charset(const VTInt gsetNumber, const VTID charset) = 0; // SCS
|
||||
virtual void Designate96Charset(const VTInt gsetNumber, const VTID charset) = 0; // SCS
|
||||
virtual void LockingShift(const VTInt gsetNumber) = 0; // LS0, LS1, LS2, LS3
|
||||
virtual void LockingShiftRight(const VTInt gsetNumber) = 0; // LS1R, LS2R, LS3R
|
||||
virtual void SingleShift(const VTInt gsetNumber) = 0; // SS2, SS3
|
||||
virtual void AcceptC1Controls(const bool enabled) = 0; // DECAC1
|
||||
virtual void AnnounceCodeStructure(const VTInt ansiLevel) = 0; // ACS
|
||||
|
||||
virtual bool SoftReset() = 0; // DECSTR
|
||||
virtual bool HardReset() = 0; // RIS
|
||||
virtual bool ScreenAlignmentPattern() = 0; // DECALN
|
||||
virtual void SoftReset() = 0; // DECSTR
|
||||
virtual void HardReset() = 0; // RIS
|
||||
virtual void ScreenAlignmentPattern() = 0; // DECALN
|
||||
|
||||
virtual bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) = 0; // DECSCUSR
|
||||
virtual void SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) = 0; // DECSCUSR
|
||||
|
||||
virtual bool SetClipboard(wil::zwstring_view content) = 0; // OSCSetClipboard
|
||||
virtual void SetClipboard(wil::zwstring_view content) = 0; // OSCSetClipboard
|
||||
|
||||
// DTTERM_WindowManipulation
|
||||
virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
virtual void WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2) = 0;
|
||||
|
||||
virtual bool AddHyperlink(const std::wstring_view uri, const std::wstring_view params) = 0;
|
||||
virtual bool EndHyperlink() = 0;
|
||||
virtual void AddHyperlink(const std::wstring_view uri, const std::wstring_view params) = 0;
|
||||
virtual void EndHyperlink() = 0;
|
||||
|
||||
virtual bool DoConEmuAction(const std::wstring_view string) = 0;
|
||||
virtual void DoConEmuAction(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool DoITerm2Action(const std::wstring_view string) = 0;
|
||||
virtual void DoITerm2Action(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool DoFinalTermAction(const std::wstring_view string) = 0;
|
||||
virtual void DoFinalTermAction(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool DoVsCodeAction(const std::wstring_view string) = 0;
|
||||
virtual void DoVsCodeAction(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool DoWTAction(const std::wstring_view string) = 0;
|
||||
virtual void DoWTAction(const std::wstring_view string) = 0;
|
||||
|
||||
virtual StringHandler DefineSixelImage(const VTInt macroParameter,
|
||||
const DispatchTypes::SixelBackground backgroundSelect,
|
||||
@ -163,23 +163,23 @@ public:
|
||||
const VTParameter cellHeight,
|
||||
const DispatchTypes::CharsetSize charsetSize) = 0; // DECDLD
|
||||
|
||||
virtual bool RequestUserPreferenceCharset() = 0; // DECRQUPSS
|
||||
virtual void RequestUserPreferenceCharset() = 0; // DECRQUPSS
|
||||
virtual StringHandler AssignUserPreferenceCharset(const DispatchTypes::CharsetSize charsetSize) = 0; // DECAUPSS
|
||||
|
||||
virtual StringHandler DefineMacro(const VTInt macroId,
|
||||
const DispatchTypes::MacroDeleteControl deleteControl,
|
||||
const DispatchTypes::MacroEncoding encoding) = 0; // DECDMAC
|
||||
virtual bool InvokeMacro(const VTInt macroId) = 0; // DECINVM
|
||||
virtual void InvokeMacro(const VTInt macroId) = 0; // DECINVM
|
||||
|
||||
virtual bool RequestTerminalStateReport(const DispatchTypes::ReportFormat format, const VTParameter formatOption) = 0; // DECRQTSR
|
||||
virtual void RequestTerminalStateReport(const DispatchTypes::ReportFormat format, const VTParameter formatOption) = 0; // DECRQTSR
|
||||
virtual StringHandler RestoreTerminalState(const DispatchTypes::ReportFormat format) = 0; // DECRSTS
|
||||
|
||||
virtual StringHandler RequestSetting() = 0; // DECRQSS
|
||||
|
||||
virtual bool RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat format) = 0; // DECRQPSR
|
||||
virtual void RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat format) = 0; // DECRQPSR
|
||||
virtual StringHandler RestorePresentationState(const DispatchTypes::PresentationReportFormat format) = 0; // DECRSPS
|
||||
|
||||
virtual bool PlaySounds(const VTParameters parameters) = 0; // DECPS
|
||||
virtual void PlaySounds(const VTParameters parameters) = 0; // DECPS
|
||||
};
|
||||
inline Microsoft::Console::VirtualTerminal::ITermDispatch::~ITermDispatch() = default;
|
||||
#pragma warning(pop)
|
||||
|
||||
@ -35,13 +35,10 @@ InteractDispatch::InteractDispatch() :
|
||||
// to be read by the client.
|
||||
// Arguments:
|
||||
// - inputEvents: a collection of IInputEvents
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool InteractDispatch::WriteInput(const std::span<const INPUT_RECORD>& inputEvents)
|
||||
void InteractDispatch::WriteInput(const std::span<const INPUT_RECORD>& inputEvents)
|
||||
{
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
gci.GetActiveInputBuffer()->Write(inputEvents);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -51,19 +48,16 @@ bool InteractDispatch::WriteInput(const std::span<const INPUT_RECORD>& inputEven
|
||||
// client application.
|
||||
// Arguments:
|
||||
// - event: The key to send to the host.
|
||||
bool InteractDispatch::WriteCtrlKey(const INPUT_RECORD& event)
|
||||
void InteractDispatch::WriteCtrlKey(const INPUT_RECORD& event)
|
||||
{
|
||||
HandleGenericKeyEvent(event, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Writes a string of input to the host.
|
||||
// Arguments:
|
||||
// - string : a string to write to the console.
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool InteractDispatch::WriteString(const std::wstring_view string)
|
||||
void InteractDispatch::WriteString(const std::wstring_view string)
|
||||
{
|
||||
if (!string.empty())
|
||||
{
|
||||
@ -77,7 +71,6 @@ bool InteractDispatch::WriteString(const std::wstring_view string)
|
||||
|
||||
WriteInput(keyEvents);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Method Description:
|
||||
@ -90,9 +83,7 @@ bool InteractDispatch::WriteString(const std::wstring_view string)
|
||||
// - function - An identifier of the WindowManipulation function to perform
|
||||
// - parameter1 - The first optional parameter for the function
|
||||
// - parameter2 - The second optional parameter for the function
|
||||
// Return value:
|
||||
// True if handled successfully. False otherwise.
|
||||
bool InteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
void InteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2)
|
||||
{
|
||||
@ -103,20 +94,20 @@ bool InteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulatio
|
||||
{
|
||||
case DispatchTypes::WindowManipulationType::DeIconifyWindow:
|
||||
_api.ShowWindow(true);
|
||||
return true;
|
||||
break;
|
||||
case DispatchTypes::WindowManipulationType::IconifyWindow:
|
||||
_api.ShowWindow(false);
|
||||
return true;
|
||||
break;
|
||||
case DispatchTypes::WindowManipulationType::RefreshWindow:
|
||||
_api.GetBufferAndViewport().buffer.TriggerRedrawAll();
|
||||
return true;
|
||||
break;
|
||||
case DispatchTypes::WindowManipulationType::ResizeWindowInCharacters:
|
||||
// TODO:GH#1765 We should introduce a better `ResizeConpty` function to
|
||||
// ConhostInternalGetSet, that specifically handles a conpty resize.
|
||||
_api.ResizeWindow(parameter2.value_or(0), parameter1.value_or(0));
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,9 +117,7 @@ bool InteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulatio
|
||||
//Arguments:
|
||||
// - row: The row to move the cursor to.
|
||||
// - col: The column to move the cursor to.
|
||||
// Return value:
|
||||
// - True.
|
||||
bool InteractDispatch::MoveCursor(const VTInt row, const VTInt col)
|
||||
void InteractDispatch::MoveCursor(const VTInt row, const VTInt col)
|
||||
{
|
||||
// First retrieve some information about the buffer
|
||||
const auto viewport = _api.GetBufferAndViewport().viewport;
|
||||
@ -142,7 +131,7 @@ bool InteractDispatch::MoveCursor(const VTInt row, const VTInt col)
|
||||
// Finally, attempt to set the adjusted cursor position back into the console.
|
||||
const auto api = gsl::not_null{ ServiceLocator::LocateGlobals().api };
|
||||
auto& info = ServiceLocator::LocateGlobals().getConsoleInformation().GetActiveOutputBuffer();
|
||||
return SUCCEEDED(api->SetConsoleCursorPositionImpl(info, coordCursor));
|
||||
LOG_IF_FAILED(api->SetConsoleCursorPositionImpl(info, coordCursor));
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -164,9 +153,7 @@ bool InteractDispatch::IsVtInputEnabled() const
|
||||
// - Used to call ConsoleControl(ConsoleSetForeground,...).
|
||||
// Arguments:
|
||||
// - focused: if the terminal is now focused
|
||||
// Return Value:
|
||||
// - true always.
|
||||
bool InteractDispatch::FocusChanged(const bool focused) const
|
||||
void InteractDispatch::FocusChanged(const bool focused)
|
||||
{
|
||||
auto& g = ServiceLocator::LocateGlobals();
|
||||
auto& gci = g.getConsoleInformation();
|
||||
@ -231,6 +218,4 @@ bool InteractDispatch::FocusChanged(const bool focused) const
|
||||
gci.pInputBuffer->WriteFocusEvent(focused);
|
||||
}
|
||||
// Does nothing outside of ConPTY. If there's a real HWND, then the HWND is solely in charge.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -25,17 +25,14 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
public:
|
||||
InteractDispatch();
|
||||
|
||||
bool WriteInput(const std::span<const INPUT_RECORD>& inputEvents) override;
|
||||
bool WriteCtrlKey(const INPUT_RECORD& event) override;
|
||||
bool WriteString(const std::wstring_view string) override;
|
||||
bool WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2) override; // DTTERM_WindowManipulation
|
||||
bool MoveCursor(const VTInt row, const VTInt col) override;
|
||||
|
||||
bool IsVtInputEnabled() const override;
|
||||
|
||||
bool FocusChanged(const bool focused) const override;
|
||||
void WriteInput(const std::span<const INPUT_RECORD>& inputEvents) override;
|
||||
void WriteCtrlKey(const INPUT_RECORD& event) override;
|
||||
void WriteString(std::wstring_view string) override;
|
||||
void WindowManipulation(DispatchTypes::WindowManipulationType function, VTParameter parameter1, VTParameter parameter2) override;
|
||||
void MoveCursor(VTInt row, VTInt col) override;
|
||||
void FocusChanged(bool focused) override;
|
||||
|
||||
private:
|
||||
ConhostInternalGetSet _api;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -41,117 +41,117 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
void Print(const wchar_t wchPrintable) override;
|
||||
void PrintString(const std::wstring_view string) override;
|
||||
|
||||
bool CursorUp(const VTInt distance) override; // CUU
|
||||
bool CursorDown(const VTInt distance) override; // CUD
|
||||
bool CursorForward(const VTInt distance) override; // CUF
|
||||
bool CursorBackward(const VTInt distance) override; // CUB, BS
|
||||
bool CursorNextLine(const VTInt distance) override; // CNL
|
||||
bool CursorPrevLine(const VTInt distance) override; // CPL
|
||||
bool CursorHorizontalPositionAbsolute(const VTInt column) override; // HPA, CHA
|
||||
bool VerticalLinePositionAbsolute(const VTInt line) override; // VPA
|
||||
bool HorizontalPositionRelative(const VTInt distance) override; // HPR
|
||||
bool VerticalPositionRelative(const VTInt distance) override; // VPR
|
||||
bool CursorPosition(const VTInt line, const VTInt column) override; // CUP, HVP
|
||||
bool CursorSaveState() override; // DECSC
|
||||
bool CursorRestoreState() override; // DECRC
|
||||
bool EraseInDisplay(const DispatchTypes::EraseType eraseType) override; // ED
|
||||
bool EraseInLine(const DispatchTypes::EraseType eraseType) override; // EL
|
||||
bool EraseCharacters(const VTInt numChars) override; // ECH
|
||||
bool SelectiveEraseInDisplay(const DispatchTypes::EraseType eraseType) override; // DECSED
|
||||
bool SelectiveEraseInLine(const DispatchTypes::EraseType eraseType) override; // DECSEL
|
||||
bool InsertCharacter(const VTInt count) override; // ICH
|
||||
bool DeleteCharacter(const VTInt count) override; // DCH
|
||||
bool ChangeAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) override; // DECCARA
|
||||
bool ReverseAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) override; // DECRARA
|
||||
bool CopyRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTInt page, const VTInt dstTop, const VTInt dstLeft, const VTInt dstPage) override; // DECCRA
|
||||
bool FillRectangularArea(const VTParameter ch, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECFRA
|
||||
bool EraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECERA
|
||||
bool SelectiveEraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECSERA
|
||||
bool SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent changeExtent) noexcept override; // DECSACE
|
||||
bool RequestChecksumRectangularArea(const VTInt id, const VTInt page, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECRQCRA
|
||||
bool SetGraphicsRendition(const VTParameters options) override; // SGR
|
||||
bool SetLineRendition(const LineRendition rendition) override; // DECSWL, DECDWL, DECDHL
|
||||
bool SetCharacterProtectionAttribute(const VTParameters options) override; // DECSCA
|
||||
bool PushGraphicsRendition(const VTParameters options) override; // XTPUSHSGR
|
||||
bool PopGraphicsRendition() override; // XTPOPSGR
|
||||
bool DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter id) override; // DSR
|
||||
bool DeviceAttributes() override; // DA1
|
||||
bool SecondaryDeviceAttributes() override; // DA2
|
||||
bool TertiaryDeviceAttributes() override; // DA3
|
||||
bool Vt52DeviceAttributes() override; // VT52 Identify
|
||||
bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) override; // DECREQTPARM
|
||||
bool ScrollUp(const VTInt distance) override; // SU
|
||||
bool ScrollDown(const VTInt distance) override; // SD
|
||||
bool NextPage(const VTInt pageCount) override; // NP
|
||||
bool PrecedingPage(const VTInt pageCount) override; // PP
|
||||
bool PagePositionAbsolute(const VTInt page) override; // PPA
|
||||
bool PagePositionRelative(const VTInt pageCount) override; // PPR
|
||||
bool PagePositionBack(const VTInt pageCount) override; // PPB
|
||||
bool RequestDisplayedExtent() override; // DECRQDE
|
||||
bool InsertLine(const VTInt distance) override; // IL
|
||||
bool DeleteLine(const VTInt distance) override; // DL
|
||||
bool InsertColumn(const VTInt distance) override; // DECIC
|
||||
bool DeleteColumn(const VTInt distance) override; // DECDC
|
||||
bool SetMode(const DispatchTypes::ModeParams param) override; // SM, DECSET
|
||||
bool ResetMode(const DispatchTypes::ModeParams param) override; // RM, DECRST
|
||||
bool RequestMode(const DispatchTypes::ModeParams param) override; // DECRQM
|
||||
bool SetKeypadMode(const bool applicationMode) noexcept override; // DECKPAM, DECKPNM
|
||||
bool SetAnsiMode(const bool ansiMode) override; // DECANM
|
||||
bool SetTopBottomScrollingMargins(const VTInt topMargin,
|
||||
void CursorUp(const VTInt distance) override; // CUU
|
||||
void CursorDown(const VTInt distance) override; // CUD
|
||||
void CursorForward(const VTInt distance) override; // CUF
|
||||
void CursorBackward(const VTInt distance) override; // CUB, BS
|
||||
void CursorNextLine(const VTInt distance) override; // CNL
|
||||
void CursorPrevLine(const VTInt distance) override; // CPL
|
||||
void CursorHorizontalPositionAbsolute(const VTInt column) override; // HPA, CHA
|
||||
void VerticalLinePositionAbsolute(const VTInt line) override; // VPA
|
||||
void HorizontalPositionRelative(const VTInt distance) override; // HPR
|
||||
void VerticalPositionRelative(const VTInt distance) override; // VPR
|
||||
void CursorPosition(const VTInt line, const VTInt column) override; // CUP, HVP
|
||||
void CursorSaveState() override; // DECSC
|
||||
void CursorRestoreState() override; // DECRC
|
||||
void EraseInDisplay(const DispatchTypes::EraseType eraseType) override; // ED
|
||||
void EraseInLine(const DispatchTypes::EraseType eraseType) override; // EL
|
||||
void EraseCharacters(const VTInt numChars) override; // ECH
|
||||
void SelectiveEraseInDisplay(const DispatchTypes::EraseType eraseType) override; // DECSED
|
||||
void SelectiveEraseInLine(const DispatchTypes::EraseType eraseType) override; // DECSEL
|
||||
void InsertCharacter(const VTInt count) override; // ICH
|
||||
void DeleteCharacter(const VTInt count) override; // DCH
|
||||
void ChangeAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) override; // DECCARA
|
||||
void ReverseAttributesRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTParameters attrs) override; // DECRARA
|
||||
void CopyRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right, const VTInt page, const VTInt dstTop, const VTInt dstLeft, const VTInt dstPage) override; // DECCRA
|
||||
void FillRectangularArea(const VTParameter ch, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECFRA
|
||||
void EraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECERA
|
||||
void SelectiveEraseRectangularArea(const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECSERA
|
||||
void SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent changeExtent) noexcept override; // DECSACE
|
||||
void RequestChecksumRectangularArea(const VTInt id, const VTInt page, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right) override; // DECRQCRA
|
||||
void SetGraphicsRendition(const VTParameters options) override; // SGR
|
||||
void SetLineRendition(const LineRendition rendition) override; // DECSWL, DECDWL, DECDHL
|
||||
void SetCharacterProtectionAttribute(const VTParameters options) override; // DECSCA
|
||||
void PushGraphicsRendition(const VTParameters options) override; // XTPUSHSGR
|
||||
void PopGraphicsRendition() override; // XTPOPSGR
|
||||
void DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter id) override; // DSR
|
||||
void DeviceAttributes() override; // DA1
|
||||
void SecondaryDeviceAttributes() override; // DA2
|
||||
void TertiaryDeviceAttributes() override; // DA3
|
||||
void Vt52DeviceAttributes() override; // VT52 Identify
|
||||
void RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) override; // DECREQTPARM
|
||||
void ScrollUp(const VTInt distance) override; // SU
|
||||
void ScrollDown(const VTInt distance) override; // SD
|
||||
void NextPage(const VTInt pageCount) override; // NP
|
||||
void PrecedingPage(const VTInt pageCount) override; // PP
|
||||
void PagePositionAbsolute(const VTInt page) override; // PPA
|
||||
void PagePositionRelative(const VTInt pageCount) override; // PPR
|
||||
void PagePositionBack(const VTInt pageCount) override; // PPB
|
||||
void RequestDisplayedExtent() override; // DECRQDE
|
||||
void InsertLine(const VTInt distance) override; // IL
|
||||
void DeleteLine(const VTInt distance) override; // DL
|
||||
void InsertColumn(const VTInt distance) override; // DECIC
|
||||
void DeleteColumn(const VTInt distance) override; // DECDC
|
||||
void SetMode(const DispatchTypes::ModeParams param) override; // SM, DECSET
|
||||
void ResetMode(const DispatchTypes::ModeParams param) override; // RM, DECRST
|
||||
void RequestMode(const DispatchTypes::ModeParams param) override; // DECRQM
|
||||
void SetKeypadMode(const bool applicationMode) noexcept override; // DECKPAM, DECKPNM
|
||||
void SetAnsiMode(const bool ansiMode) override; // DECANM
|
||||
void SetTopBottomScrollingMargins(const VTInt topMargin,
|
||||
const VTInt bottomMargin) override; // DECSTBM
|
||||
bool SetLeftRightScrollingMargins(const VTInt leftMargin,
|
||||
void SetLeftRightScrollingMargins(const VTInt leftMargin,
|
||||
const VTInt rightMargin) override; // DECSLRM
|
||||
bool EnquireAnswerback() override; // ENQ
|
||||
bool WarningBell() override; // BEL
|
||||
bool CarriageReturn() override; // CR
|
||||
bool LineFeed(const DispatchTypes::LineFeedType lineFeedType) override; // IND, NEL, LF, FF, VT
|
||||
bool ReverseLineFeed() override; // RI
|
||||
bool BackIndex() override; // DECBI
|
||||
bool ForwardIndex() override; // DECFI
|
||||
bool SetWindowTitle(const std::wstring_view title) override; // DECSWT, OSCWindowTitle
|
||||
bool HorizontalTabSet() override; // HTS
|
||||
bool ForwardTab(const VTInt numTabs) override; // CHT, HT
|
||||
bool BackwardsTab(const VTInt numTabs) override; // CBT
|
||||
bool TabClear(const DispatchTypes::TabClearType clearType) override; // TBC
|
||||
bool TabSet(const VTParameter setType) noexcept override; // DECST8C
|
||||
bool DesignateCodingSystem(const VTID codingSystem) override; // DOCS
|
||||
bool Designate94Charset(const VTInt gsetNumber, const VTID charset) override; // SCS
|
||||
bool Designate96Charset(const VTInt gsetNumber, const VTID charset) override; // SCS
|
||||
bool LockingShift(const VTInt gsetNumber) override; // LS0, LS1, LS2, LS3
|
||||
bool LockingShiftRight(const VTInt gsetNumber) override; // LS1R, LS2R, LS3R
|
||||
bool SingleShift(const VTInt gsetNumber) noexcept override; // SS2, SS3
|
||||
bool AcceptC1Controls(const bool enabled) override; // DECAC1
|
||||
bool AnnounceCodeStructure(const VTInt ansiLevel) override; // ACS
|
||||
bool SoftReset() override; // DECSTR
|
||||
bool HardReset() override; // RIS
|
||||
bool ScreenAlignmentPattern() override; // DECALN
|
||||
bool SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) override; // DECSCUSR
|
||||
void EnquireAnswerback() override; // ENQ
|
||||
void WarningBell() override; // BEL
|
||||
void CarriageReturn() override; // CR
|
||||
void LineFeed(const DispatchTypes::LineFeedType lineFeedType) override; // IND, NEL, LF, FF, VT
|
||||
void ReverseLineFeed() override; // RI
|
||||
void BackIndex() override; // DECBI
|
||||
void ForwardIndex() override; // DECFI
|
||||
void SetWindowTitle(const std::wstring_view title) override; // DECSWT, OSCWindowTitle
|
||||
void HorizontalTabSet() override; // HTS
|
||||
void ForwardTab(const VTInt numTabs) override; // CHT, HT
|
||||
void BackwardsTab(const VTInt numTabs) override; // CBT
|
||||
void TabClear(const DispatchTypes::TabClearType clearType) override; // TBC
|
||||
void TabSet(const VTParameter setType) noexcept override; // DECST8C
|
||||
void DesignateCodingSystem(const VTID codingSystem) override; // DOCS
|
||||
void Designate94Charset(const VTInt gsetNumber, const VTID charset) override; // SCS
|
||||
void Designate96Charset(const VTInt gsetNumber, const VTID charset) override; // SCS
|
||||
void LockingShift(const VTInt gsetNumber) override; // LS0, LS1, LS2, LS3
|
||||
void LockingShiftRight(const VTInt gsetNumber) override; // LS1R, LS2R, LS3R
|
||||
void SingleShift(const VTInt gsetNumber) noexcept override; // SS2, SS3
|
||||
void AcceptC1Controls(const bool enabled) override; // DECAC1
|
||||
void AnnounceCodeStructure(const VTInt ansiLevel) override; // ACS
|
||||
void SoftReset() override; // DECSTR
|
||||
void HardReset() override; // RIS
|
||||
void ScreenAlignmentPattern() override; // DECALN
|
||||
void SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle) override; // DECSCUSR
|
||||
|
||||
bool SetClipboard(const wil::zwstring_view content) override; // OSCSetClipboard
|
||||
void SetClipboard(const wil::zwstring_view content) override; // OSCSetClipboard
|
||||
|
||||
bool SetColorTableEntry(const size_t tableIndex,
|
||||
void SetColorTableEntry(const size_t tableIndex,
|
||||
const DWORD color) override; // OSCSetColorTable
|
||||
bool RequestColorTableEntry(const size_t tableIndex) override; // OSCGetColorTable
|
||||
bool SetXtermColorResource(const size_t resource, const DWORD color) override; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
bool RequestXtermColorResource(const size_t resource) override; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
bool AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) override; // DECAC
|
||||
void RequestColorTableEntry(const size_t tableIndex) override; // OSCGetColorTable
|
||||
void SetXtermColorResource(const size_t resource, const DWORD color) override; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
void RequestXtermColorResource(const size_t resource) override; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
void AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) override; // DECAC
|
||||
|
||||
bool WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
void WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2) override; // DTTERM_WindowManipulation
|
||||
|
||||
bool AddHyperlink(const std::wstring_view uri, const std::wstring_view params) override;
|
||||
bool EndHyperlink() override;
|
||||
void AddHyperlink(const std::wstring_view uri, const std::wstring_view params) override;
|
||||
void EndHyperlink() override;
|
||||
|
||||
bool DoConEmuAction(const std::wstring_view string) override;
|
||||
void DoConEmuAction(const std::wstring_view string) override;
|
||||
|
||||
bool DoITerm2Action(const std::wstring_view string) override;
|
||||
void DoITerm2Action(const std::wstring_view string) override;
|
||||
|
||||
bool DoFinalTermAction(const std::wstring_view string) override;
|
||||
void DoFinalTermAction(const std::wstring_view string) override;
|
||||
|
||||
bool DoVsCodeAction(const std::wstring_view string) override;
|
||||
void DoVsCodeAction(const std::wstring_view string) override;
|
||||
|
||||
bool DoWTAction(const std::wstring_view string) override;
|
||||
void DoWTAction(const std::wstring_view string) override;
|
||||
|
||||
StringHandler DefineSixelImage(const VTInt macroParameter,
|
||||
const DispatchTypes::SixelBackground backgroundSelect,
|
||||
@ -166,23 +166,23 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
const VTParameter cellHeight,
|
||||
const DispatchTypes::CharsetSize charsetSize) override; // DECDLD
|
||||
|
||||
bool RequestUserPreferenceCharset() override; // DECRQUPSS
|
||||
void RequestUserPreferenceCharset() override; // DECRQUPSS
|
||||
StringHandler AssignUserPreferenceCharset(const DispatchTypes::CharsetSize charsetSize) override; // DECAUPSS
|
||||
|
||||
StringHandler DefineMacro(const VTInt macroId,
|
||||
const DispatchTypes::MacroDeleteControl deleteControl,
|
||||
const DispatchTypes::MacroEncoding encoding) override; // DECDMAC
|
||||
bool InvokeMacro(const VTInt macroId) override; // DECINVM
|
||||
void InvokeMacro(const VTInt macroId) override; // DECINVM
|
||||
|
||||
bool RequestTerminalStateReport(const DispatchTypes::ReportFormat format, const VTParameter formatOption) override; // DECRQTSR
|
||||
void RequestTerminalStateReport(const DispatchTypes::ReportFormat format, const VTParameter formatOption) override; // DECRQTSR
|
||||
StringHandler RestoreTerminalState(const DispatchTypes::ReportFormat format) override; // DECRSTS
|
||||
|
||||
StringHandler RequestSetting() override; // DECRQSS
|
||||
|
||||
bool RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat format) override; // DECRQPSR
|
||||
void RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat format) override; // DECRQPSR
|
||||
StringHandler RestorePresentationState(const DispatchTypes::PresentationReportFormat format) override; // DECRSPS
|
||||
|
||||
bool PlaySounds(const VTParameters parameters) override; // DECPS
|
||||
void PlaySounds(const VTParameters parameters) override; // DECPS
|
||||
|
||||
private:
|
||||
enum class Mode
|
||||
@ -234,15 +234,15 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
void _WriteToBuffer(const std::wstring_view string);
|
||||
std::pair<int, int> _GetVerticalMargins(const Page& page, const bool absolute) noexcept;
|
||||
std::pair<int, int> _GetHorizontalMargins(const til::CoordType bufferWidth) noexcept;
|
||||
bool _CursorMovePosition(const Offset rowOffset, const Offset colOffset, const bool clampInMargins);
|
||||
void _CursorMovePosition(const Offset rowOffset, const Offset colOffset, const bool clampInMargins);
|
||||
void _ApplyCursorMovementFlags(Cursor& cursor) noexcept;
|
||||
void _FillRect(const Page& page, const til::rect& fillRect, const std::wstring_view& fillChar, const TextAttribute& fillAttrs) const;
|
||||
void _SelectiveEraseRect(const Page& page, const til::rect& eraseRect);
|
||||
void _ChangeRectAttributes(const Page& page, const til::rect& changeRect, const ChangeOps& changeOps);
|
||||
void _ChangeRectOrStreamAttributes(const til::rect& changeArea, const ChangeOps& changeOps);
|
||||
til::rect _CalculateRectArea(const Page& page, const VTInt top, const VTInt left, const VTInt bottom, const VTInt right);
|
||||
bool _EraseScrollback();
|
||||
bool _EraseAll();
|
||||
void _EraseScrollback();
|
||||
void _EraseAll();
|
||||
TextAttribute _GetEraseAttributes(const Page& page) const noexcept;
|
||||
void _ScrollRectVertically(const Page& page, const til::rect& scrollRect, const VTInt delta);
|
||||
void _ScrollRectHorizontally(const Page& page, const til::rect& scrollRect, const VTInt delta);
|
||||
@ -267,7 +267,7 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
void _SetColumnMode(const bool enable);
|
||||
void _SetAlternateScreenBufferMode(const bool enable);
|
||||
bool _ModeParamsHelper(const DispatchTypes::ModeParams param, const bool enable);
|
||||
void _ModeParamsHelper(const DispatchTypes::ModeParams param, const bool enable);
|
||||
|
||||
void _ClearSingleTabStop();
|
||||
void _ClearAllTabStops() noexcept;
|
||||
|
||||
@ -418,15 +418,12 @@ void AdaptDispatch::_ApplyGraphicsOptions(const VTParameters options,
|
||||
// Arguments:
|
||||
// - options - An array of options that will be applied from 0 to N, in order,
|
||||
// one at a time by setting or removing flags in the font style properties.
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool AdaptDispatch::SetGraphicsRendition(const VTParameters options)
|
||||
void AdaptDispatch::SetGraphicsRendition(const VTParameters options)
|
||||
{
|
||||
const auto page = _pages.ActivePage();
|
||||
auto attr = page.Attributes();
|
||||
_ApplyGraphicsOptions(options, attr);
|
||||
page.SetAttributes(attr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -435,9 +432,7 @@ bool AdaptDispatch::SetGraphicsRendition(const VTParameters options)
|
||||
// but the protected attribute was the only one ever implemented.
|
||||
// Arguments:
|
||||
// - options - An array of options that will be applied in order.
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool AdaptDispatch::SetCharacterProtectionAttribute(const VTParameters options)
|
||||
void AdaptDispatch::SetCharacterProtectionAttribute(const VTParameters options)
|
||||
{
|
||||
const auto page = _pages.ActivePage();
|
||||
auto attr = page.Attributes();
|
||||
@ -458,7 +453,6 @@ bool AdaptDispatch::SetCharacterProtectionAttribute(const VTParameters options)
|
||||
}
|
||||
}
|
||||
page.SetAttributes(attr);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -467,13 +461,10 @@ bool AdaptDispatch::SetCharacterProtectionAttribute(const VTParameters options)
|
||||
// - options: if not empty, specify which portions of the current text attributes should
|
||||
// be saved. Options that are not supported are ignored. If no options are specified,
|
||||
// all attributes are stored.
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool AdaptDispatch::PushGraphicsRendition(const VTParameters options)
|
||||
void AdaptDispatch::PushGraphicsRendition(const VTParameters options)
|
||||
{
|
||||
const auto& currentAttributes = _pages.ActivePage().Attributes();
|
||||
_sgrStack.Push(currentAttributes, options);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -481,12 +472,9 @@ bool AdaptDispatch::PushGraphicsRendition(const VTParameters options)
|
||||
// were saved, combines those with the current attributes.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - True.
|
||||
bool AdaptDispatch::PopGraphicsRendition()
|
||||
void AdaptDispatch::PopGraphicsRendition()
|
||||
{
|
||||
const auto page = _pages.ActivePage();
|
||||
const auto& currentAttributes = page.Attributes();
|
||||
page.SetAttributes(_sgrStack.Pop(currentAttributes));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -25,123 +25,123 @@ public:
|
||||
void Print(const wchar_t wchPrintable) override = 0;
|
||||
void PrintString(const std::wstring_view string) override = 0;
|
||||
|
||||
bool CursorUp(const VTInt /*distance*/) override { return false; } // CUU
|
||||
bool CursorDown(const VTInt /*distance*/) override { return false; } // CUD
|
||||
bool CursorForward(const VTInt /*distance*/) override { return false; } // CUF
|
||||
bool CursorBackward(const VTInt /*distance*/) override { return false; } // CUB, BS
|
||||
bool CursorNextLine(const VTInt /*distance*/) override { return false; } // CNL
|
||||
bool CursorPrevLine(const VTInt /*distance*/) override { return false; } // CPL
|
||||
bool CursorHorizontalPositionAbsolute(const VTInt /*column*/) override { return false; } // HPA, CHA
|
||||
bool VerticalLinePositionAbsolute(const VTInt /*line*/) override { return false; } // VPA
|
||||
bool HorizontalPositionRelative(const VTInt /*distance*/) override { return false; } // HPR
|
||||
bool VerticalPositionRelative(const VTInt /*distance*/) override { return false; } // VPR
|
||||
bool CursorPosition(const VTInt /*line*/, const VTInt /*column*/) override { return false; } // CUP, HVP
|
||||
bool CursorSaveState() override { return false; } // DECSC
|
||||
bool CursorRestoreState() override { return false; } // DECRC
|
||||
bool InsertCharacter(const VTInt /*count*/) override { return false; } // ICH
|
||||
bool DeleteCharacter(const VTInt /*count*/) override { return false; } // DCH
|
||||
bool ScrollUp(const VTInt /*distance*/) override { return false; } // SU
|
||||
bool ScrollDown(const VTInt /*distance*/) override { return false; } // SD
|
||||
bool NextPage(const VTInt /*pageCount*/) override { return false; } // NP
|
||||
bool PrecedingPage(const VTInt /*pageCount*/) override { return false; } // PP
|
||||
bool PagePositionAbsolute(const VTInt /*page*/) override { return false; } // PPA
|
||||
bool PagePositionRelative(const VTInt /*pageCount*/) override { return false; } // PPR
|
||||
bool PagePositionBack(const VTInt /*pageCount*/) override { return false; } // PPB
|
||||
bool RequestDisplayedExtent() override { return false; } // DECRQDE
|
||||
bool InsertLine(const VTInt /*distance*/) override { return false; } // IL
|
||||
bool DeleteLine(const VTInt /*distance*/) override { return false; } // DL
|
||||
bool InsertColumn(const VTInt /*distance*/) override { return false; } // DECIC
|
||||
bool DeleteColumn(const VTInt /*distance*/) override { return false; } // DECDC
|
||||
bool SetKeypadMode(const bool /*applicationMode*/) override { return false; } // DECKPAM, DECKPNM
|
||||
bool SetAnsiMode(const bool /*ansiMode*/) override { return false; } // DECANM
|
||||
bool SetTopBottomScrollingMargins(const VTInt /*topMargin*/, const VTInt /*bottomMargin*/) override { return false; } // DECSTBM
|
||||
bool SetLeftRightScrollingMargins(const VTInt /*leftMargin*/, const VTInt /*rightMargin*/) override { return false; } // DECSLRM
|
||||
bool EnquireAnswerback() override { return false; } // ENQ
|
||||
bool WarningBell() override { return false; } // BEL
|
||||
bool CarriageReturn() override { return false; } // CR
|
||||
bool LineFeed(const DispatchTypes::LineFeedType /*lineFeedType*/) override { return false; } // IND, NEL, LF, FF, VT
|
||||
bool ReverseLineFeed() override { return false; } // RI
|
||||
bool BackIndex() override { return false; } // DECBI
|
||||
bool ForwardIndex() override { return false; } // DECFI
|
||||
bool SetWindowTitle(std::wstring_view /*title*/) override { return false; } // DECSWT, OscWindowTitle
|
||||
bool HorizontalTabSet() override { return false; } // HTS
|
||||
bool ForwardTab(const VTInt /*numTabs*/) override { return false; } // CHT, HT
|
||||
bool BackwardsTab(const VTInt /*numTabs*/) override { return false; } // CBT
|
||||
bool TabClear(const DispatchTypes::TabClearType /*clearType*/) override { return false; } // TBC
|
||||
bool TabSet(const VTParameter /*setType*/) override { return false; } // DECST8C
|
||||
bool SetColorTableEntry(const size_t /*tableIndex*/, const DWORD /*color*/) override { return false; } // OSCSetColorTable
|
||||
bool RequestColorTableEntry(const size_t /*tableIndex*/) override { return false; } // OSCGetColorTable
|
||||
bool SetXtermColorResource(const size_t /*resource*/, const DWORD /*color*/) override { return false; } // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
bool RequestXtermColorResource(const size_t /*resource*/) override { return false; } // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
bool AssignColor(const DispatchTypes::ColorItem /*item*/, const VTInt /*fgIndex*/, const VTInt /*bgIndex*/) override { return false; } // DECAC
|
||||
void CursorUp(const VTInt /*distance*/) override {} // CUU
|
||||
void CursorDown(const VTInt /*distance*/) override {} // CUD
|
||||
void CursorForward(const VTInt /*distance*/) override {} // CUF
|
||||
void CursorBackward(const VTInt /*distance*/) override {} // CUB, BS
|
||||
void CursorNextLine(const VTInt /*distance*/) override {} // CNL
|
||||
void CursorPrevLine(const VTInt /*distance*/) override {} // CPL
|
||||
void CursorHorizontalPositionAbsolute(const VTInt /*column*/) override {} // HPA, CHA
|
||||
void VerticalLinePositionAbsolute(const VTInt /*line*/) override {} // VPA
|
||||
void HorizontalPositionRelative(const VTInt /*distance*/) override {} // HPR
|
||||
void VerticalPositionRelative(const VTInt /*distance*/) override {} // VPR
|
||||
void CursorPosition(const VTInt /*line*/, const VTInt /*column*/) override {} // CUP, HVP
|
||||
void CursorSaveState() override {} // DECSC
|
||||
void CursorRestoreState() override {} // DECRC
|
||||
void InsertCharacter(const VTInt /*count*/) override {} // ICH
|
||||
void DeleteCharacter(const VTInt /*count*/) override {} // DCH
|
||||
void ScrollUp(const VTInt /*distance*/) override {} // SU
|
||||
void ScrollDown(const VTInt /*distance*/) override {} // SD
|
||||
void NextPage(const VTInt /*pageCount*/) override {} // NP
|
||||
void PrecedingPage(const VTInt /*pageCount*/) override {} // PP
|
||||
void PagePositionAbsolute(const VTInt /*page*/) override {} // PPA
|
||||
void PagePositionRelative(const VTInt /*pageCount*/) override {} // PPR
|
||||
void PagePositionBack(const VTInt /*pageCount*/) override {} // PPB
|
||||
void RequestDisplayedExtent() override {} // DECRQDE
|
||||
void InsertLine(const VTInt /*distance*/) override {} // IL
|
||||
void DeleteLine(const VTInt /*distance*/) override {} // DL
|
||||
void InsertColumn(const VTInt /*distance*/) override {} // DECIC
|
||||
void DeleteColumn(const VTInt /*distance*/) override {} // DECDC
|
||||
void SetKeypadMode(const bool /*applicationMode*/) override {} // DECKPAM, DECKPNM
|
||||
void SetAnsiMode(const bool /*ansiMode*/) override {} // DECANM
|
||||
void SetTopBottomScrollingMargins(const VTInt /*topMargin*/, const VTInt /*bottomMargin*/) override {} // DECSTBM
|
||||
void SetLeftRightScrollingMargins(const VTInt /*leftMargin*/, const VTInt /*rightMargin*/) override {} // DECSLRM
|
||||
void EnquireAnswerback() override {} // ENQ
|
||||
void WarningBell() override {} // BEL
|
||||
void CarriageReturn() override {} // CR
|
||||
void LineFeed(const DispatchTypes::LineFeedType /*lineFeedType*/) override {} // IND, NEL, LF, FF, VT
|
||||
void ReverseLineFeed() override {} // RI
|
||||
void BackIndex() override {} // DECBI
|
||||
void ForwardIndex() override {} // DECFI
|
||||
void SetWindowTitle(std::wstring_view /*title*/) override {} // DECSWT, OscWindowTitle
|
||||
void HorizontalTabSet() override {} // HTS
|
||||
void ForwardTab(const VTInt /*numTabs*/) override {} // CHT, HT
|
||||
void BackwardsTab(const VTInt /*numTabs*/) override {} // CBT
|
||||
void TabClear(const DispatchTypes::TabClearType /*clearType*/) override {} // TBC
|
||||
void TabSet(const VTParameter /*setType*/) override {} // DECST8C
|
||||
void SetColorTableEntry(const size_t /*tableIndex*/, const DWORD /*color*/) override {} // OSCSetColorTable
|
||||
void RequestColorTableEntry(const size_t /*tableIndex*/) override {} // OSCGetColorTable
|
||||
void SetXtermColorResource(const size_t /*resource*/, const DWORD /*color*/) override {} // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
void RequestXtermColorResource(const size_t /*resource*/) override {} // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
void AssignColor(const DispatchTypes::ColorItem /*item*/, const VTInt /*fgIndex*/, const VTInt /*bgIndex*/) override {} // DECAC
|
||||
|
||||
bool EraseInDisplay(const DispatchTypes::EraseType /* eraseType*/) override { return false; } // ED
|
||||
bool EraseInLine(const DispatchTypes::EraseType /* eraseType*/) override { return false; } // EL
|
||||
bool EraseCharacters(const VTInt /*numChars*/) override { return false; } // ECH
|
||||
bool SelectiveEraseInDisplay(const DispatchTypes::EraseType /*eraseType*/) override { return false; } // DECSED
|
||||
bool SelectiveEraseInLine(const DispatchTypes::EraseType /*eraseType*/) override { return false; } // DECSEL
|
||||
void EraseInDisplay(const DispatchTypes::EraseType /* eraseType*/) override {} // ED
|
||||
void EraseInLine(const DispatchTypes::EraseType /* eraseType*/) override {} // EL
|
||||
void EraseCharacters(const VTInt /*numChars*/) override {} // ECH
|
||||
void SelectiveEraseInDisplay(const DispatchTypes::EraseType /*eraseType*/) override {} // DECSED
|
||||
void SelectiveEraseInLine(const DispatchTypes::EraseType /*eraseType*/) override {} // DECSEL
|
||||
|
||||
bool ChangeAttributesRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTParameters /*attrs*/) override { return false; } // DECCARA
|
||||
bool ReverseAttributesRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTParameters /*attrs*/) override { return false; } // DECRARA
|
||||
bool CopyRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTInt /*page*/, const VTInt /*dstTop*/, const VTInt /*dstLeft*/, const VTInt /*dstPage*/) override { return false; } // DECCRA
|
||||
bool FillRectangularArea(const VTParameter /*ch*/, const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override { return false; } // DECFRA
|
||||
bool EraseRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override { return false; } // DECERA
|
||||
bool SelectiveEraseRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override { return false; } // DECSERA
|
||||
bool SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent /*changeExtent*/) override { return false; } // DECSACE
|
||||
bool RequestChecksumRectangularArea(const VTInt /*id*/, const VTInt /*page*/, const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override { return false; } // DECRQCRA
|
||||
void ChangeAttributesRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTParameters /*attrs*/) override {} // DECCARA
|
||||
void ReverseAttributesRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTParameters /*attrs*/) override {} // DECRARA
|
||||
void CopyRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/, const VTInt /*page*/, const VTInt /*dstTop*/, const VTInt /*dstLeft*/, const VTInt /*dstPage*/) override {} // DECCRA
|
||||
void FillRectangularArea(const VTParameter /*ch*/, const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override {} // DECFRA
|
||||
void EraseRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override {} // DECERA
|
||||
void SelectiveEraseRectangularArea(const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override {} // DECSERA
|
||||
void SelectAttributeChangeExtent(const DispatchTypes::ChangeExtent /*changeExtent*/) override {} // DECSACE
|
||||
void RequestChecksumRectangularArea(const VTInt /*id*/, const VTInt /*page*/, const VTInt /*top*/, const VTInt /*left*/, const VTInt /*bottom*/, const VTInt /*right*/) override {} // DECRQCRA
|
||||
|
||||
bool SetGraphicsRendition(const VTParameters /*options*/) override { return false; } // SGR
|
||||
bool SetLineRendition(const LineRendition /*rendition*/) override { return false; } // DECSWL, DECDWL, DECDHL
|
||||
bool SetCharacterProtectionAttribute(const VTParameters /*options*/) override { return false; } // DECSCA
|
||||
void SetGraphicsRendition(const VTParameters /*options*/) override {} // SGR
|
||||
void SetLineRendition(const LineRendition /*rendition*/) override {} // DECSWL, DECDWL, DECDHL
|
||||
void SetCharacterProtectionAttribute(const VTParameters /*options*/) override {} // DECSCA
|
||||
|
||||
bool PushGraphicsRendition(const VTParameters /*options*/) override { return false; } // XTPUSHSGR
|
||||
bool PopGraphicsRendition() override { return false; } // XTPOPSGR
|
||||
void PushGraphicsRendition(const VTParameters /*options*/) override {} // XTPUSHSGR
|
||||
void PopGraphicsRendition() override {} // XTPOPSGR
|
||||
|
||||
bool SetMode(const DispatchTypes::ModeParams /*param*/) override { return false; } // SM, DECSET
|
||||
bool ResetMode(const DispatchTypes::ModeParams /*param*/) override { return false; } // RM, DECRST
|
||||
bool RequestMode(const DispatchTypes::ModeParams /*param*/) override { return false; } // DECRQM
|
||||
void SetMode(const DispatchTypes::ModeParams /*param*/) override {} // SM, DECSET
|
||||
void ResetMode(const DispatchTypes::ModeParams /*param*/) override {} // RM, DECRST
|
||||
void RequestMode(const DispatchTypes::ModeParams /*param*/) override {} // DECRQM
|
||||
|
||||
bool DeviceStatusReport(const DispatchTypes::StatusType /*statusType*/, const VTParameter /*id*/) override { return false; } // DSR
|
||||
bool DeviceAttributes() override { return false; } // DA1
|
||||
bool SecondaryDeviceAttributes() override { return false; } // DA2
|
||||
bool TertiaryDeviceAttributes() override { return false; } // DA3
|
||||
bool Vt52DeviceAttributes() override { return false; } // VT52 Identify
|
||||
bool RequestTerminalParameters(const DispatchTypes::ReportingPermission /*permission*/) override { return false; } // DECREQTPARM
|
||||
void DeviceStatusReport(const DispatchTypes::StatusType /*statusType*/, const VTParameter /*id*/) override {} // DSR
|
||||
void DeviceAttributes() override {} // DA1
|
||||
void SecondaryDeviceAttributes() override {} // DA2
|
||||
void TertiaryDeviceAttributes() override {} // DA3
|
||||
void Vt52DeviceAttributes() override {} // VT52 Identify
|
||||
void RequestTerminalParameters(const DispatchTypes::ReportingPermission /*permission*/) override {} // DECREQTPARM
|
||||
|
||||
bool DesignateCodingSystem(const VTID /*codingSystem*/) override { return false; } // DOCS
|
||||
bool Designate94Charset(const VTInt /*gsetNumber*/, const VTID /*charset*/) override { return false; } // SCS
|
||||
bool Designate96Charset(const VTInt /*gsetNumber*/, const VTID /*charset*/) override { return false; } // SCS
|
||||
bool LockingShift(const VTInt /*gsetNumber*/) override { return false; } // LS0, LS1, LS2, LS3
|
||||
bool LockingShiftRight(const VTInt /*gsetNumber*/) override { return false; } // LS1R, LS2R, LS3R
|
||||
bool SingleShift(const VTInt /*gsetNumber*/) override { return false; } // SS2, SS3
|
||||
bool AcceptC1Controls(const bool /*enabled*/) override { return false; } // DECAC1
|
||||
bool AnnounceCodeStructure(const VTInt /*ansiLevel*/) override { return false; } // ACS
|
||||
void DesignateCodingSystem(const VTID /*codingSystem*/) override {} // DOCS
|
||||
void Designate94Charset(const VTInt /*gsetNumber*/, const VTID /*charset*/) override {} // SCS
|
||||
void Designate96Charset(const VTInt /*gsetNumber*/, const VTID /*charset*/) override {} // SCS
|
||||
void LockingShift(const VTInt /*gsetNumber*/) override {} // LS0, LS1, LS2, LS3
|
||||
void LockingShiftRight(const VTInt /*gsetNumber*/) override {} // LS1R, LS2R, LS3R
|
||||
void SingleShift(const VTInt /*gsetNumber*/) override {} // SS2, SS3
|
||||
void AcceptC1Controls(const bool /*enabled*/) override {} // DECAC1
|
||||
void AnnounceCodeStructure(const VTInt /*ansiLevel*/) override {} // ACS
|
||||
|
||||
bool SoftReset() override { return false; } // DECSTR
|
||||
bool HardReset() override { return false; } // RIS
|
||||
bool ScreenAlignmentPattern() override { return false; } // DECALN
|
||||
void SoftReset() override {} // DECSTR
|
||||
void HardReset() override {} // RIS
|
||||
void ScreenAlignmentPattern() override {} // DECALN
|
||||
|
||||
bool SetCursorStyle(const DispatchTypes::CursorStyle /*cursorStyle*/) override { return false; } // DECSCUSR
|
||||
void SetCursorStyle(const DispatchTypes::CursorStyle /*cursorStyle*/) override {} // DECSCUSR
|
||||
|
||||
bool SetClipboard(wil::zwstring_view /*content*/) override { return false; } // OscSetClipboard
|
||||
void SetClipboard(wil::zwstring_view /*content*/) override {} // OscSetClipboard
|
||||
|
||||
// DTTERM_WindowManipulation
|
||||
bool WindowManipulation(const DispatchTypes::WindowManipulationType /*function*/,
|
||||
void WindowManipulation(const DispatchTypes::WindowManipulationType /*function*/,
|
||||
const VTParameter /*parameter1*/,
|
||||
const VTParameter /*parameter2*/) override { return false; }
|
||||
const VTParameter /*parameter2*/) override {}
|
||||
|
||||
bool AddHyperlink(const std::wstring_view /*uri*/, const std::wstring_view /*params*/) override { return false; }
|
||||
bool EndHyperlink() override { return false; }
|
||||
void AddHyperlink(const std::wstring_view /*uri*/, const std::wstring_view /*params*/) override {}
|
||||
void EndHyperlink() override {}
|
||||
|
||||
bool DoConEmuAction(const std::wstring_view /*string*/) override { return false; }
|
||||
void DoConEmuAction(const std::wstring_view /*string*/) override {}
|
||||
|
||||
bool DoITerm2Action(const std::wstring_view /*string*/) override { return false; }
|
||||
void DoITerm2Action(const std::wstring_view /*string*/) override {}
|
||||
|
||||
bool DoFinalTermAction(const std::wstring_view /*string*/) override { return false; }
|
||||
void DoFinalTermAction(const std::wstring_view /*string*/) override {}
|
||||
|
||||
bool DoVsCodeAction(const std::wstring_view /*string*/) override { return false; }
|
||||
void DoVsCodeAction(const std::wstring_view /*string*/) override {}
|
||||
|
||||
bool DoWTAction(const std::wstring_view /*string*/) override { return false; }
|
||||
void DoWTAction(const std::wstring_view /*string*/) override {}
|
||||
|
||||
StringHandler DefineSixelImage(const VTInt /*macroParameter*/,
|
||||
const DispatchTypes::SixelBackground /*backgroundSelect*/,
|
||||
@ -156,23 +156,23 @@ public:
|
||||
const VTParameter /*cellHeight*/,
|
||||
const DispatchTypes::CharsetSize /*charsetSize*/) override { return nullptr; } // DECDLD
|
||||
|
||||
bool RequestUserPreferenceCharset() override { return false; } // DECRQUPSS
|
||||
void RequestUserPreferenceCharset() override {} // DECRQUPSS
|
||||
StringHandler AssignUserPreferenceCharset(const DispatchTypes::CharsetSize /*charsetSize*/) override { return nullptr; } // DECAUPSS
|
||||
|
||||
StringHandler DefineMacro(const VTInt /*macroId*/,
|
||||
const DispatchTypes::MacroDeleteControl /*deleteControl*/,
|
||||
const DispatchTypes::MacroEncoding /*encoding*/) override { return nullptr; } // DECDMAC
|
||||
bool InvokeMacro(const VTInt /*macroId*/) override { return false; } // DECINVM
|
||||
void InvokeMacro(const VTInt /*macroId*/) override {} // DECINVM
|
||||
|
||||
bool RequestTerminalStateReport(const DispatchTypes::ReportFormat /*format*/, const VTParameter /*formatOption*/) override { return false; } // DECRQTSR
|
||||
void RequestTerminalStateReport(const DispatchTypes::ReportFormat /*format*/, const VTParameter /*formatOption*/) override {} // DECRQTSR
|
||||
StringHandler RestoreTerminalState(const DispatchTypes::ReportFormat /*format*/) override { return nullptr; }; // DECRSTS
|
||||
|
||||
StringHandler RequestSetting() override { return nullptr; }; // DECRQSS
|
||||
|
||||
bool RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat /*format*/) override { return false; } // DECRQPSR
|
||||
void RequestPresentationStateReport(const DispatchTypes::PresentationReportFormat /*format*/) override {} // DECRQPSR
|
||||
StringHandler RestorePresentationState(const DispatchTypes::PresentationReportFormat /*format*/) override { return nullptr; } // DECRSPS
|
||||
|
||||
bool PlaySounds(const VTParameters /*parameters*/) override { return false; }; // DECPS
|
||||
void PlaySounds(const VTParameters /*parameters*/) override{}; // DECPS
|
||||
};
|
||||
|
||||
#pragma warning(default : 26440) // Restore "can be declared noexcept" warning
|
||||
|
||||
@ -47,10 +47,14 @@ void TerminalOutput::RestoreFrom(const TerminalOutput& savedState) noexcept
|
||||
_grTranslationEnabled = preserveGrTranslation;
|
||||
}
|
||||
|
||||
bool TerminalOutput::AssignUserPreferenceCharset(const VTID charset, const bool size96)
|
||||
void TerminalOutput::AssignUserPreferenceCharset(const VTID charset, const bool size96)
|
||||
{
|
||||
const auto translationTable = size96 ? _LookupTranslationTable96(charset) : _LookupTranslationTable94(charset);
|
||||
RETURN_BOOL_IF_FALSE(!translationTable.empty());
|
||||
if (translationTable.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_upssId = charset;
|
||||
_upssTranslationTable = translationTable;
|
||||
// Any G-set mapped to UPSS will need its translation table updated.
|
||||
@ -64,7 +68,6 @@ bool TerminalOutput::AssignUserPreferenceCharset(const VTID charset, const bool
|
||||
// We also reapply the locking shifts in case they need to be updated.
|
||||
LockingShift(_glSetNumber);
|
||||
LockingShiftRight(_grSetNumber);
|
||||
return true;
|
||||
}
|
||||
|
||||
VTID TerminalOutput::GetUserPreferenceCharsetId() const noexcept
|
||||
@ -77,20 +80,28 @@ size_t TerminalOutput::GetUserPreferenceCharsetSize() const noexcept
|
||||
return _upssTranslationTable.size() == 96 ? 96 : 94;
|
||||
}
|
||||
|
||||
bool TerminalOutput::Designate94Charset(size_t gsetNumber, const VTID charset)
|
||||
void TerminalOutput::Designate94Charset(size_t gsetNumber, const VTID charset)
|
||||
{
|
||||
const auto translationTable = _LookupTranslationTable94(charset);
|
||||
RETURN_BOOL_IF_FALSE(!translationTable.empty());
|
||||
if (translationTable.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_gsetIds.at(gsetNumber) = charset;
|
||||
return _SetTranslationTable(gsetNumber, translationTable);
|
||||
_SetTranslationTable(gsetNumber, translationTable);
|
||||
}
|
||||
|
||||
bool TerminalOutput::Designate96Charset(size_t gsetNumber, const VTID charset)
|
||||
void TerminalOutput::Designate96Charset(size_t gsetNumber, const VTID charset)
|
||||
{
|
||||
const auto translationTable = _LookupTranslationTable96(charset);
|
||||
RETURN_BOOL_IF_FALSE(!translationTable.empty());
|
||||
if (translationTable.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_gsetIds.at(gsetNumber) = charset;
|
||||
return _SetTranslationTable(gsetNumber, translationTable);
|
||||
_SetTranslationTable(gsetNumber, translationTable);
|
||||
}
|
||||
|
||||
void TerminalOutput::SetDrcs94Designation(const VTID charset)
|
||||
@ -118,7 +129,7 @@ size_t TerminalOutput::GetCharsetSize(const size_t gsetNumber) const
|
||||
}
|
||||
|
||||
#pragma warning(suppress : 26440) // Suppress spurious "function can be declared noexcept" warning
|
||||
bool TerminalOutput::LockingShift(const size_t gsetNumber)
|
||||
void TerminalOutput::LockingShift(const size_t gsetNumber)
|
||||
{
|
||||
_glSetNumber = gsetNumber;
|
||||
_glTranslationTable = _gsetTranslationTables.at(_glSetNumber);
|
||||
@ -127,11 +138,10 @@ bool TerminalOutput::LockingShift(const size_t gsetNumber)
|
||||
{
|
||||
_glTranslationTable = {};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma warning(suppress : 26440) // Suppress spurious "function can be declared noexcept" warning
|
||||
bool TerminalOutput::LockingShiftRight(const size_t gsetNumber)
|
||||
void TerminalOutput::LockingShiftRight(const size_t gsetNumber)
|
||||
{
|
||||
_grSetNumber = gsetNumber;
|
||||
_grTranslationTable = _gsetTranslationTables.at(_grSetNumber);
|
||||
@ -140,13 +150,11 @@ bool TerminalOutput::LockingShiftRight(const size_t gsetNumber)
|
||||
{
|
||||
_grTranslationTable = {};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerminalOutput::SingleShift(const size_t gsetNumber) noexcept
|
||||
void TerminalOutput::SingleShift(const size_t gsetNumber) noexcept
|
||||
{
|
||||
_ssSetNumber = gsetNumber;
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t TerminalOutput::GetLeftSetNumber() const noexcept
|
||||
@ -325,11 +333,12 @@ const std::wstring_view TerminalOutput::_LookupTranslationTable96(const VTID cha
|
||||
}
|
||||
}
|
||||
|
||||
bool TerminalOutput::_SetTranslationTable(const size_t gsetNumber, const std::wstring_view translationTable)
|
||||
void TerminalOutput::_SetTranslationTable(const size_t gsetNumber, const std::wstring_view translationTable)
|
||||
{
|
||||
_gsetTranslationTables.at(gsetNumber) = translationTable;
|
||||
// We need to reapply the locking shifts in case the underlying G-sets have changed.
|
||||
return LockingShift(_glSetNumber) && LockingShiftRight(_grSetNumber);
|
||||
LockingShift(_glSetNumber);
|
||||
LockingShiftRight(_grSetNumber);
|
||||
}
|
||||
|
||||
void TerminalOutput::_ReplaceDrcsTable(const std::wstring_view oldTable, const std::wstring_view newTable)
|
||||
|
||||
@ -27,19 +27,19 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
void SoftReset() noexcept;
|
||||
void RestoreFrom(const TerminalOutput& savedState) noexcept;
|
||||
bool AssignUserPreferenceCharset(const VTID charset, const bool size96);
|
||||
void AssignUserPreferenceCharset(const VTID charset, const bool size96);
|
||||
VTID GetUserPreferenceCharsetId() const noexcept;
|
||||
size_t GetUserPreferenceCharsetSize() const noexcept;
|
||||
wchar_t TranslateKey(const wchar_t wch) const noexcept;
|
||||
bool Designate94Charset(const size_t gsetNumber, const VTID charset);
|
||||
bool Designate96Charset(const size_t gsetNumber, const VTID charset);
|
||||
void Designate94Charset(const size_t gsetNumber, const VTID charset);
|
||||
void Designate96Charset(const size_t gsetNumber, const VTID charset);
|
||||
void SetDrcs94Designation(const VTID charset);
|
||||
void SetDrcs96Designation(const VTID charset);
|
||||
VTID GetCharsetId(const size_t gsetNumber) const;
|
||||
size_t GetCharsetSize(const size_t gsetNumber) const;
|
||||
bool LockingShift(const size_t gsetNumber);
|
||||
bool LockingShiftRight(const size_t gsetNumber);
|
||||
bool SingleShift(const size_t gsetNumber) noexcept;
|
||||
void LockingShift(const size_t gsetNumber);
|
||||
void LockingShiftRight(const size_t gsetNumber);
|
||||
void SingleShift(const size_t gsetNumber) noexcept;
|
||||
size_t GetLeftSetNumber() const noexcept;
|
||||
size_t GetRightSetNumber() const noexcept;
|
||||
bool IsSingleShiftPending(const size_t gsetNumber) const noexcept;
|
||||
@ -49,7 +49,7 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
private:
|
||||
const std::wstring_view _LookupTranslationTable94(const VTID charset) const;
|
||||
const std::wstring_view _LookupTranslationTable96(const VTID charset) const;
|
||||
bool _SetTranslationTable(const size_t gsetNumber, const std::wstring_view translationTable);
|
||||
void _SetTranslationTable(const size_t gsetNumber, const std::wstring_view translationTable);
|
||||
void _ReplaceDrcsTable(const std::wstring_view oldTable, const std::wstring_view newTable);
|
||||
|
||||
VTID _upssId;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,19 +35,13 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
virtual bool ActionPrint(const wchar_t wch) = 0;
|
||||
virtual bool ActionPrintString(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool ActionPassThroughString(const std::wstring_view string, const bool flush = false) = 0;
|
||||
virtual bool ActionPassThroughString(const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool ActionEscDispatch(const VTID id) = 0;
|
||||
virtual bool ActionVt52EscDispatch(const VTID id, const VTParameters parameters) = 0;
|
||||
virtual bool ActionCsiDispatch(const VTID id, const VTParameters parameters) = 0;
|
||||
virtual StringHandler ActionDcsDispatch(const VTID id, const VTParameters parameters) = 0;
|
||||
|
||||
virtual bool ActionClear() = 0;
|
||||
|
||||
virtual bool ActionIgnore() = 0;
|
||||
|
||||
virtual bool ActionOscDispatch(const size_t parameter, const std::wstring_view string) = 0;
|
||||
|
||||
virtual bool ActionSs3Dispatch(const wchar_t wch, const VTParameters parameters) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@ -97,7 +97,6 @@ InputStateMachineEngine::InputStateMachineEngine(std::unique_ptr<IInteractDispat
|
||||
InputStateMachineEngine::InputStateMachineEngine(std::unique_ptr<IInteractDispatch> pDispatch, const bool lookingForDSR) :
|
||||
_pDispatch(std::move(pDispatch)),
|
||||
_lookingForDSR(lookingForDSR),
|
||||
_pfnFlushToInputQueue(nullptr),
|
||||
_doubleClickTime(std::chrono::milliseconds(GetDoubleClickTime()))
|
||||
{
|
||||
THROW_HR_IF_NULL(E_INVALIDARG, _pDispatch.get());
|
||||
@ -139,7 +138,6 @@ bool InputStateMachineEngine::ActionExecute(const wchar_t wch)
|
||||
// - True if successfully generated and written. False otherwise.
|
||||
bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool writeAlt)
|
||||
{
|
||||
auto success = false;
|
||||
if (wch == UNICODE_ETX && !writeAlt)
|
||||
{
|
||||
// This is Ctrl+C, which is handled specially by the host.
|
||||
@ -147,7 +145,6 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
|
||||
static constexpr auto keyUp = SynthesizeKeyEvent(false, 1, L'C', 0, UNICODE_ETX, LEFT_CTRL_PRESSED);
|
||||
_pDispatch->WriteCtrlKey(keyDown);
|
||||
_pDispatch->WriteCtrlKey(keyUp);
|
||||
success = true;
|
||||
}
|
||||
else if (wch >= '\x0' && wch < '\x20')
|
||||
{
|
||||
@ -155,6 +152,7 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
|
||||
// This should be translated as Ctrl+(wch+x40)
|
||||
auto actualChar = wch;
|
||||
auto writeCtrl = true;
|
||||
auto success = false;
|
||||
|
||||
short vkey = 0;
|
||||
DWORD modifierState = 0;
|
||||
@ -200,7 +198,7 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
|
||||
WI_SetFlag(modifierState, LEFT_ALT_PRESSED);
|
||||
}
|
||||
|
||||
success = _WriteSingleKey(actualChar, vkey, modifierState);
|
||||
_WriteSingleKey(actualChar, vkey, modifierState);
|
||||
}
|
||||
}
|
||||
else if (wch == '\x7f')
|
||||
@ -212,13 +210,13 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
|
||||
// "delete" any input at all, only backspace.
|
||||
// Because of this, we're treating x7f as backspace, like most
|
||||
// terminals do.
|
||||
success = _WriteSingleKey('\x8', VK_BACK, writeAlt ? LEFT_ALT_PRESSED : 0);
|
||||
_WriteSingleKey('\x8', VK_BACK, writeAlt ? LEFT_ALT_PRESSED : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = ActionPrint(wch);
|
||||
ActionPrint(wch);
|
||||
}
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -234,9 +232,9 @@ bool InputStateMachineEngine::_DoControlCharacter(const wchar_t wch, const bool
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionExecuteFromEscape(const wchar_t wch)
|
||||
{
|
||||
if (_pDispatch->IsVtInputEnabled() && _pfnFlushToInputQueue)
|
||||
if (_pDispatch->IsVtInputEnabled())
|
||||
{
|
||||
return _pfnFlushToInputQueue();
|
||||
return false;
|
||||
}
|
||||
|
||||
return _DoControlCharacter(wch, true);
|
||||
@ -253,12 +251,11 @@ bool InputStateMachineEngine::ActionPrint(const wchar_t wch)
|
||||
{
|
||||
short vkey = 0;
|
||||
DWORD modifierState = 0;
|
||||
auto success = _GenerateKeyFromChar(wch, vkey, modifierState);
|
||||
if (success)
|
||||
if (_GenerateKeyFromChar(wch, vkey, modifierState))
|
||||
{
|
||||
success = _WriteSingleKey(wch, vkey, modifierState);
|
||||
_WriteSingleKey(wch, vkey, modifierState);
|
||||
}
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -270,11 +267,11 @@ bool InputStateMachineEngine::ActionPrint(const wchar_t wch)
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionPrintString(const std::wstring_view string)
|
||||
{
|
||||
if (string.empty())
|
||||
if (!string.empty())
|
||||
{
|
||||
return true;
|
||||
_pDispatch->WriteString(string);
|
||||
}
|
||||
return _pDispatch->WriteString(string);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -285,23 +282,30 @@ bool InputStateMachineEngine::ActionPrintString(const std::wstring_view string)
|
||||
// - flush - not applicable to the input state machine.
|
||||
// Return Value:
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view string, const bool /*flush*/)
|
||||
bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view string)
|
||||
{
|
||||
if (string.empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_pDispatch->IsVtInputEnabled())
|
||||
{
|
||||
// Synthesize string into key events that we'll write to the buffer
|
||||
// similar to TerminalInput::_SendInputSequence
|
||||
if (!string.empty())
|
||||
InputEventQueue inputEvents;
|
||||
for (const auto& wch : string)
|
||||
{
|
||||
InputEventQueue inputEvents;
|
||||
for (const auto& wch : string)
|
||||
{
|
||||
inputEvents.push_back(SynthesizeKeyEvent(true, 1, 0, 0, wch, 0));
|
||||
}
|
||||
return _pDispatch->WriteInput(inputEvents);
|
||||
inputEvents.push_back(SynthesizeKeyEvent(true, 1, 0, 0, wch, 0));
|
||||
}
|
||||
_pDispatch->WriteInput(inputEvents);
|
||||
}
|
||||
return ActionPrintString(string);
|
||||
else
|
||||
{
|
||||
_pDispatch->WriteString(string);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -314,36 +318,32 @@ bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view st
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionEscDispatch(const VTID id)
|
||||
{
|
||||
if (_pDispatch->IsVtInputEnabled() && _pfnFlushToInputQueue)
|
||||
if (_pDispatch->IsVtInputEnabled())
|
||||
{
|
||||
return _pfnFlushToInputQueue();
|
||||
return false;
|
||||
}
|
||||
|
||||
auto success = false;
|
||||
|
||||
// There are no intermediates, so the id is effectively the final char.
|
||||
const auto wch = gsl::narrow_cast<wchar_t>(id);
|
||||
|
||||
// 0x7f is DEL, which we treat effectively the same as a ctrl character.
|
||||
if (wch == 0x7f)
|
||||
{
|
||||
success = _DoControlCharacter(wch, true);
|
||||
_DoControlCharacter(wch, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD modifierState = 0;
|
||||
short vk = 0;
|
||||
success = _GenerateKeyFromChar(wch, vk, modifierState);
|
||||
if (success)
|
||||
if (_GenerateKeyFromChar(wch, vk, modifierState))
|
||||
{
|
||||
// Alt is definitely pressed in the esc+key case.
|
||||
modifierState = WI_SetFlag(modifierState, LEFT_ALT_PRESSED);
|
||||
|
||||
success = _WriteSingleKey(wch, vk, modifierState);
|
||||
_WriteSingleKey(wch, vk, modifierState);
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -382,18 +382,13 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
|
||||
// Focus events in conpty are special, so don't flush those through either.
|
||||
// See GH#12799, GH#12900 for details
|
||||
if (_pDispatch->IsVtInputEnabled() &&
|
||||
_pfnFlushToInputQueue &&
|
||||
id != CsiActionCodes::Win32KeyboardInput &&
|
||||
id != CsiActionCodes::FocusIn &&
|
||||
id != CsiActionCodes::FocusOut)
|
||||
{
|
||||
return _pfnFlushToInputQueue();
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD modifierState = 0;
|
||||
short vkey = 0;
|
||||
|
||||
auto success = false;
|
||||
switch (id)
|
||||
{
|
||||
case CsiActionCodes::MouseDown:
|
||||
@ -404,10 +399,12 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
|
||||
const auto firstParameter = parameters.at(0).value_or(0);
|
||||
const til::point uiPos{ parameters.at(1) - 1, parameters.at(2) - 1 };
|
||||
|
||||
modifierState = _GetSGRMouseModifierState(firstParameter);
|
||||
success = _UpdateSGRMouseButtonState(id, firstParameter, buttonState, eventFlags, uiPos);
|
||||
success = success && _WriteMouseEvent(uiPos, buttonState, modifierState, eventFlags);
|
||||
break;
|
||||
if (_UpdateSGRMouseButtonState(id, firstParameter, buttonState, eventFlags, uiPos))
|
||||
{
|
||||
const auto modifierState = _GetSGRMouseModifierState(firstParameter);
|
||||
_WriteMouseEvent(uiPos, buttonState, modifierState, eventFlags);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// case CsiActionCodes::DSR_DeviceStatusReportResponse:
|
||||
case CsiActionCodes::CSI_F3:
|
||||
@ -416,12 +413,18 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
|
||||
// Else, fall though to the _GetCursorKeysModifierState handler.
|
||||
if (_lookingForDSR.load(std::memory_order::relaxed))
|
||||
{
|
||||
success = _pDispatch->MoveCursor(parameters.at(0), parameters.at(1));
|
||||
_pDispatch->MoveCursor(parameters.at(0), parameters.at(1));
|
||||
// Right now we're only looking for on initial cursor
|
||||
// position response. After that, only look for F3.
|
||||
_lookingForDSR.store(false, std::memory_order::relaxed);
|
||||
til::atomic_notify_all(_lookingForDSR);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
// Heuristic: If the hosting terminal used the win32 input mode, chances are high
|
||||
// that this is a CPR requested by the terminal application as opposed to a F3 key.
|
||||
if (_encounteredWin32InputModeSequence)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
[[fallthrough]];
|
||||
case CsiActionCodes::ArrowUp:
|
||||
@ -433,43 +436,47 @@ bool InputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParameter
|
||||
case CsiActionCodes::CSI_F1:
|
||||
case CsiActionCodes::CSI_F2:
|
||||
case CsiActionCodes::CSI_F4:
|
||||
success = _GetCursorKeysVkey(id, vkey);
|
||||
modifierState = _GetCursorKeysModifierState(parameters, id);
|
||||
success = success && _WriteSingleKey(vkey, modifierState);
|
||||
break;
|
||||
{
|
||||
short vkey = 0;
|
||||
if (_GetCursorKeysVkey(id, vkey))
|
||||
{
|
||||
const auto modifierState = _GetCursorKeysModifierState(parameters, id);
|
||||
_WriteSingleKey(vkey, modifierState);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case CsiActionCodes::Generic:
|
||||
success = _GetGenericVkey(parameters.at(0), vkey);
|
||||
modifierState = _GetGenericKeysModifierState(parameters);
|
||||
success = success && _WriteSingleKey(vkey, modifierState);
|
||||
break;
|
||||
{
|
||||
short vkey = 0;
|
||||
if (_GetGenericVkey(parameters.at(0), vkey))
|
||||
{
|
||||
const auto modifierState = _GetGenericKeysModifierState(parameters);
|
||||
_WriteSingleKey(vkey, modifierState);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case CsiActionCodes::CursorBackTab:
|
||||
success = _WriteSingleKey(VK_TAB, SHIFT_PRESSED);
|
||||
break;
|
||||
case CsiActionCodes::DTTERM_WindowManipulation:
|
||||
success = _pDispatch->WindowManipulation(parameters.at(0), parameters.at(1), parameters.at(2));
|
||||
break;
|
||||
_WriteSingleKey(VK_TAB, SHIFT_PRESSED);
|
||||
return true;
|
||||
case CsiActionCodes::FocusIn:
|
||||
success = _pDispatch->FocusChanged(true);
|
||||
break;
|
||||
_pDispatch->FocusChanged(true);
|
||||
return true;
|
||||
case CsiActionCodes::FocusOut:
|
||||
success = _pDispatch->FocusChanged(false);
|
||||
break;
|
||||
_pDispatch->FocusChanged(false);
|
||||
return true;
|
||||
case CsiActionCodes::Win32KeyboardInput:
|
||||
{
|
||||
// Use WriteCtrlKey here, even for keys that _aren't_ control keys,
|
||||
// because that will take extra steps to make sure things like
|
||||
// Ctrl+C, Ctrl+Break are handled correctly.
|
||||
const auto key = _GenerateWin32Key(parameters);
|
||||
success = _pDispatch->WriteCtrlKey(key);
|
||||
_pDispatch->WriteCtrlKey(key);
|
||||
_encounteredWin32InputModeSequence = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
success = false;
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -498,47 +505,19 @@ IStateMachineEngine::StringHandler InputStateMachineEngine::ActionDcsDispatch(co
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionSs3Dispatch(const wchar_t wch, const VTParameters /*parameters*/)
|
||||
{
|
||||
if (_pDispatch->IsVtInputEnabled() && _pfnFlushToInputQueue)
|
||||
if (_pDispatch->IsVtInputEnabled())
|
||||
{
|
||||
return _pfnFlushToInputQueue();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ss3 sequence keys aren't modified.
|
||||
// When F1-F4 *are* modified, they're sent as CSI sequences, not SS3's.
|
||||
const DWORD modifierState = 0;
|
||||
short vkey = 0;
|
||||
|
||||
auto success = _GetSs3KeysVkey(wch, vkey);
|
||||
|
||||
if (success)
|
||||
if (_GetSs3KeysVkey(wch, vkey))
|
||||
{
|
||||
success = _WriteSingleKey(vkey, modifierState);
|
||||
_WriteSingleKey(vkey, 0);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Triggers the Clear action to indicate that the state machine should erase
|
||||
// all internal state.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionClear() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Triggers the Ignore action to indicate that the state machine should eat
|
||||
// this character and say nothing.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool InputStateMachineEngine::ActionIgnore() noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -550,7 +529,7 @@ bool InputStateMachineEngine::ActionIgnore() noexcept
|
||||
// - string - OSC string we've collected. NOT null terminated.
|
||||
// Return Value:
|
||||
// - true if we handled the dispatch.
|
||||
bool InputStateMachineEngine::ActionOscDispatch(const size_t /*parameter*/, const std::wstring_view /*string*/)
|
||||
bool InputStateMachineEngine::ActionOscDispatch(const size_t /*parameter*/, const std::wstring_view /*string*/) noexcept
|
||||
{
|
||||
// Unlike ActionCsiDispatch, we are not checking whether the application has requested
|
||||
// VT input.
|
||||
@ -559,10 +538,6 @@ bool InputStateMachineEngine::ActionOscDispatch(const size_t /*parameter*/, cons
|
||||
// that for CSI reports because we may incidentally pass through non-response VT input;
|
||||
// however, there should be no OSC on the input stream *except* for responses.
|
||||
// It should be safe to pass all OSCs from the input stream through to the application.
|
||||
if (_pfnFlushToInputQueue)
|
||||
{
|
||||
return _pfnFlushToInputQueue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -693,12 +668,12 @@ void InputStateMachineEngine::_GetSingleKeypress(const wchar_t wch,
|
||||
// - modifierState - the modifier state to write with the key.
|
||||
// Return Value:
|
||||
// - true iff we successfully wrote the keypress to the input callback.
|
||||
bool InputStateMachineEngine::_WriteSingleKey(const wchar_t wch, const short vkey, const DWORD modifierState)
|
||||
void InputStateMachineEngine::_WriteSingleKey(const wchar_t wch, const short vkey, const DWORD modifierState)
|
||||
{
|
||||
// At most 8 records - 2 for each of shift,ctrl,alt up and down, and 2 for the actual key up and down.
|
||||
InputEventQueue inputEvents;
|
||||
_GenerateWrappedSequence(wch, vkey, modifierState, inputEvents);
|
||||
return _pDispatch->WriteInput(inputEvents);
|
||||
_pDispatch->WriteInput(inputEvents);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -709,10 +684,10 @@ bool InputStateMachineEngine::_WriteSingleKey(const wchar_t wch, const short vke
|
||||
// - modifierState - the modifier state to write with the key.
|
||||
// Return Value:
|
||||
// - true iff we successfully wrote the keypress to the input callback.
|
||||
bool InputStateMachineEngine::_WriteSingleKey(const short vkey, const DWORD modifierState)
|
||||
void InputStateMachineEngine::_WriteSingleKey(const short vkey, const DWORD modifierState)
|
||||
{
|
||||
const auto wch = gsl::narrow_cast<wchar_t>(OneCoreSafeMapVirtualKeyW(vkey, MAPVK_VK_TO_CHAR));
|
||||
return _WriteSingleKey(wch, vkey, modifierState);
|
||||
_WriteSingleKey(wch, vkey, modifierState);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -725,10 +700,10 @@ bool InputStateMachineEngine::_WriteSingleKey(const short vkey, const DWORD modi
|
||||
// - eventFlags - the type of mouse event to write to the mouse record.
|
||||
// Return Value:
|
||||
// - true iff we successfully wrote the keypress to the input callback.
|
||||
bool InputStateMachineEngine::_WriteMouseEvent(const til::point uiPos, const DWORD buttonState, const DWORD controlKeyState, const DWORD eventFlags)
|
||||
void InputStateMachineEngine::_WriteMouseEvent(const til::point uiPos, const DWORD buttonState, const DWORD controlKeyState, const DWORD eventFlags)
|
||||
{
|
||||
const auto rgInput = SynthesizeMouseEvent(uiPos, buttonState, controlKeyState, eventFlags);
|
||||
return _pDispatch->WriteInput({ &rgInput, 1 });
|
||||
_pDispatch->WriteInput({ &rgInput, 1 });
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -1051,22 +1026,6 @@ bool InputStateMachineEngine::_GenerateKeyFromChar(const wchar_t wch,
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Sets us up for vt input passthrough.
|
||||
// We'll set a couple members, and if they aren't null, when we get a
|
||||
// sequence we don't understand, we'll pass it along to the app
|
||||
// instead of eating it ourselves.
|
||||
// Arguments:
|
||||
// - pfnFlushToInputQueue: This is a callback to the underlying state machine to
|
||||
// trigger it to call ActionPassThroughString with whatever sequence it's
|
||||
// currently processing.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void InputStateMachineEngine::SetFlushToInputQueueCallback(std::function<bool()> pfnFlushToInputQueue)
|
||||
{
|
||||
_pfnFlushToInputQueue = pfnFlushToInputQueue;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Retrieves the type of window manipulation operation from the parameter pool
|
||||
// stored during Param actions.
|
||||
|
||||
@ -143,7 +143,7 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
bool ActionPrintString(const std::wstring_view string) override;
|
||||
|
||||
bool ActionPassThroughString(const std::wstring_view string, const bool flush) override;
|
||||
bool ActionPassThroughString(const std::wstring_view string) override;
|
||||
|
||||
bool ActionEscDispatch(const VTID id) override;
|
||||
|
||||
@ -153,19 +153,12 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
StringHandler ActionDcsDispatch(const VTID id, const VTParameters parameters) noexcept override;
|
||||
|
||||
bool ActionClear() noexcept override;
|
||||
|
||||
bool ActionIgnore() noexcept override;
|
||||
|
||||
bool ActionOscDispatch(const size_t parameter, const std::wstring_view string) override;
|
||||
bool ActionOscDispatch(const size_t parameter, const std::wstring_view string) noexcept override;
|
||||
|
||||
bool ActionSs3Dispatch(const wchar_t wch, const VTParameters parameters) override;
|
||||
|
||||
void SetFlushToInputQueueCallback(std::function<bool()> pfnFlushToInputQueue);
|
||||
|
||||
private:
|
||||
const std::unique_ptr<IInteractDispatch> _pDispatch;
|
||||
std::function<bool()> _pfnFlushToInputQueue;
|
||||
std::atomic<bool> _lookingForDSR{ false };
|
||||
bool _encounteredWin32InputModeSequence = false;
|
||||
DWORD _mouseButtonState = 0;
|
||||
@ -190,10 +183,10 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
bool _GetCursorKeysVkey(const VTID id, short& vkey) const;
|
||||
bool _GetSs3KeysVkey(const wchar_t wch, short& vkey) const;
|
||||
|
||||
bool _WriteSingleKey(const short vkey, const DWORD modifierState);
|
||||
bool _WriteSingleKey(const wchar_t wch, const short vkey, const DWORD modifierState);
|
||||
void _WriteSingleKey(const short vkey, const DWORD modifierState);
|
||||
void _WriteSingleKey(const wchar_t wch, const short vkey, const DWORD modifierState);
|
||||
|
||||
bool _WriteMouseEvent(const til::point uiPos, const DWORD buttonState, const DWORD controlKeyState, const DWORD eventFlags);
|
||||
void _WriteMouseEvent(const til::point uiPos, const DWORD buttonState, const DWORD controlKeyState, const DWORD eventFlags);
|
||||
|
||||
void _GenerateWrappedSequence(const wchar_t wch,
|
||||
const short vkey,
|
||||
|
||||
@ -176,7 +176,7 @@ bool OutputStateMachineEngine::ActionPrintString(const std::wstring_view string)
|
||||
// - flush - set to true if the string should be flushed immediately.
|
||||
// Return Value:
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool OutputStateMachineEngine::ActionPassThroughString(const std::wstring_view /*string*/, const bool /*flush*/) noexcept
|
||||
bool OutputStateMachineEngine::ActionPassThroughString(const std::wstring_view /*string*/) noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -191,97 +191,94 @@ bool OutputStateMachineEngine::ActionPassThroughString(const std::wstring_view /
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool OutputStateMachineEngine::ActionEscDispatch(const VTID id)
|
||||
{
|
||||
auto success = false;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case EscActionCodes::ST_StringTerminator:
|
||||
// This is the 7-bit string terminator, which is essentially a no-op.
|
||||
success = true;
|
||||
break;
|
||||
case EscActionCodes::DECBI_BackIndex:
|
||||
success = _dispatch->BackIndex();
|
||||
_dispatch->BackIndex();
|
||||
break;
|
||||
case EscActionCodes::DECSC_CursorSave:
|
||||
success = _dispatch->CursorSaveState();
|
||||
_dispatch->CursorSaveState();
|
||||
break;
|
||||
case EscActionCodes::DECRC_CursorRestore:
|
||||
success = _dispatch->CursorRestoreState();
|
||||
_dispatch->CursorRestoreState();
|
||||
break;
|
||||
case EscActionCodes::DECFI_ForwardIndex:
|
||||
success = _dispatch->ForwardIndex();
|
||||
_dispatch->ForwardIndex();
|
||||
break;
|
||||
case EscActionCodes::DECKPAM_KeypadApplicationMode:
|
||||
success = _dispatch->SetKeypadMode(true);
|
||||
_dispatch->SetKeypadMode(true);
|
||||
break;
|
||||
case EscActionCodes::DECKPNM_KeypadNumericMode:
|
||||
success = _dispatch->SetKeypadMode(false);
|
||||
_dispatch->SetKeypadMode(false);
|
||||
break;
|
||||
case EscActionCodes::NEL_NextLine:
|
||||
success = _dispatch->LineFeed(DispatchTypes::LineFeedType::WithReturn);
|
||||
_dispatch->LineFeed(DispatchTypes::LineFeedType::WithReturn);
|
||||
break;
|
||||
case EscActionCodes::IND_Index:
|
||||
success = _dispatch->LineFeed(DispatchTypes::LineFeedType::WithoutReturn);
|
||||
_dispatch->LineFeed(DispatchTypes::LineFeedType::WithoutReturn);
|
||||
break;
|
||||
case EscActionCodes::RI_ReverseLineFeed:
|
||||
success = _dispatch->ReverseLineFeed();
|
||||
_dispatch->ReverseLineFeed();
|
||||
break;
|
||||
case EscActionCodes::HTS_HorizontalTabSet:
|
||||
success = _dispatch->HorizontalTabSet();
|
||||
_dispatch->HorizontalTabSet();
|
||||
break;
|
||||
case EscActionCodes::DECID_IdentifyDevice:
|
||||
success = _dispatch->DeviceAttributes();
|
||||
_dispatch->DeviceAttributes();
|
||||
break;
|
||||
case EscActionCodes::RIS_ResetToInitialState:
|
||||
success = _dispatch->HardReset();
|
||||
_dispatch->HardReset();
|
||||
break;
|
||||
case EscActionCodes::SS2_SingleShift:
|
||||
success = _dispatch->SingleShift(2);
|
||||
_dispatch->SingleShift(2);
|
||||
break;
|
||||
case EscActionCodes::SS3_SingleShift:
|
||||
success = _dispatch->SingleShift(3);
|
||||
_dispatch->SingleShift(3);
|
||||
break;
|
||||
case EscActionCodes::LS2_LockingShift:
|
||||
success = _dispatch->LockingShift(2);
|
||||
_dispatch->LockingShift(2);
|
||||
break;
|
||||
case EscActionCodes::LS3_LockingShift:
|
||||
success = _dispatch->LockingShift(3);
|
||||
_dispatch->LockingShift(3);
|
||||
break;
|
||||
case EscActionCodes::LS1R_LockingShift:
|
||||
success = _dispatch->LockingShiftRight(1);
|
||||
_dispatch->LockingShiftRight(1);
|
||||
break;
|
||||
case EscActionCodes::LS2R_LockingShift:
|
||||
success = _dispatch->LockingShiftRight(2);
|
||||
_dispatch->LockingShiftRight(2);
|
||||
break;
|
||||
case EscActionCodes::LS3R_LockingShift:
|
||||
success = _dispatch->LockingShiftRight(3);
|
||||
_dispatch->LockingShiftRight(3);
|
||||
break;
|
||||
case EscActionCodes::DECAC1_AcceptC1Controls:
|
||||
success = _dispatch->AcceptC1Controls(true);
|
||||
_dispatch->AcceptC1Controls(true);
|
||||
break;
|
||||
case EscActionCodes::ACS_AnsiLevel1:
|
||||
success = _dispatch->AnnounceCodeStructure(1);
|
||||
_dispatch->AnnounceCodeStructure(1);
|
||||
break;
|
||||
case EscActionCodes::ACS_AnsiLevel2:
|
||||
success = _dispatch->AnnounceCodeStructure(2);
|
||||
_dispatch->AnnounceCodeStructure(2);
|
||||
break;
|
||||
case EscActionCodes::ACS_AnsiLevel3:
|
||||
success = _dispatch->AnnounceCodeStructure(3);
|
||||
_dispatch->AnnounceCodeStructure(3);
|
||||
break;
|
||||
case EscActionCodes::DECDHL_DoubleHeightLineTop:
|
||||
success = _dispatch->SetLineRendition(LineRendition::DoubleHeightTop);
|
||||
_dispatch->SetLineRendition(LineRendition::DoubleHeightTop);
|
||||
break;
|
||||
case EscActionCodes::DECDHL_DoubleHeightLineBottom:
|
||||
success = _dispatch->SetLineRendition(LineRendition::DoubleHeightBottom);
|
||||
_dispatch->SetLineRendition(LineRendition::DoubleHeightBottom);
|
||||
break;
|
||||
case EscActionCodes::DECSWL_SingleWidthLine:
|
||||
success = _dispatch->SetLineRendition(LineRendition::SingleWidth);
|
||||
_dispatch->SetLineRendition(LineRendition::SingleWidth);
|
||||
break;
|
||||
case EscActionCodes::DECDWL_DoubleWidthLine:
|
||||
success = _dispatch->SetLineRendition(LineRendition::DoubleWidth);
|
||||
_dispatch->SetLineRendition(LineRendition::DoubleWidth);
|
||||
break;
|
||||
case EscActionCodes::DECALN_ScreenAlignmentPattern:
|
||||
success = _dispatch->ScreenAlignmentPattern();
|
||||
_dispatch->ScreenAlignmentPattern();
|
||||
break;
|
||||
default:
|
||||
const auto commandChar = id[0];
|
||||
@ -289,39 +286,37 @@ bool OutputStateMachineEngine::ActionEscDispatch(const VTID id)
|
||||
switch (commandChar)
|
||||
{
|
||||
case '%':
|
||||
success = _dispatch->DesignateCodingSystem(commandParameter);
|
||||
_dispatch->DesignateCodingSystem(commandParameter);
|
||||
break;
|
||||
case '(':
|
||||
success = _dispatch->Designate94Charset(0, commandParameter);
|
||||
_dispatch->Designate94Charset(0, commandParameter);
|
||||
break;
|
||||
case ')':
|
||||
success = _dispatch->Designate94Charset(1, commandParameter);
|
||||
_dispatch->Designate94Charset(1, commandParameter);
|
||||
break;
|
||||
case '*':
|
||||
success = _dispatch->Designate94Charset(2, commandParameter);
|
||||
_dispatch->Designate94Charset(2, commandParameter);
|
||||
break;
|
||||
case '+':
|
||||
success = _dispatch->Designate94Charset(3, commandParameter);
|
||||
_dispatch->Designate94Charset(3, commandParameter);
|
||||
break;
|
||||
case '-':
|
||||
success = _dispatch->Designate96Charset(1, commandParameter);
|
||||
_dispatch->Designate96Charset(1, commandParameter);
|
||||
break;
|
||||
case '.':
|
||||
success = _dispatch->Designate96Charset(2, commandParameter);
|
||||
_dispatch->Designate96Charset(2, commandParameter);
|
||||
break;
|
||||
case '/':
|
||||
success = _dispatch->Designate96Charset(3, commandParameter);
|
||||
_dispatch->Designate96Charset(3, commandParameter);
|
||||
break;
|
||||
default:
|
||||
// If no functions to call, overall dispatch was a failure.
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_ClearLastChar();
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@ -335,66 +330,62 @@ bool OutputStateMachineEngine::ActionEscDispatch(const VTID id)
|
||||
// - true iff we successfully dispatched the sequence.
|
||||
bool OutputStateMachineEngine::ActionVt52EscDispatch(const VTID id, const VTParameters parameters)
|
||||
{
|
||||
auto success = false;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case Vt52ActionCodes::CursorUp:
|
||||
success = _dispatch->CursorUp(1);
|
||||
_dispatch->CursorUp(1);
|
||||
break;
|
||||
case Vt52ActionCodes::CursorDown:
|
||||
success = _dispatch->CursorDown(1);
|
||||
_dispatch->CursorDown(1);
|
||||
break;
|
||||
case Vt52ActionCodes::CursorRight:
|
||||
success = _dispatch->CursorForward(1);
|
||||
_dispatch->CursorForward(1);
|
||||
break;
|
||||
case Vt52ActionCodes::CursorLeft:
|
||||
success = _dispatch->CursorBackward(1);
|
||||
_dispatch->CursorBackward(1);
|
||||
break;
|
||||
case Vt52ActionCodes::EnterGraphicsMode:
|
||||
success = _dispatch->Designate94Charset(0, DispatchTypes::CharacterSets::DecSpecialGraphics);
|
||||
_dispatch->Designate94Charset(0, DispatchTypes::CharacterSets::DecSpecialGraphics);
|
||||
break;
|
||||
case Vt52ActionCodes::ExitGraphicsMode:
|
||||
success = _dispatch->Designate94Charset(0, DispatchTypes::CharacterSets::ASCII);
|
||||
_dispatch->Designate94Charset(0, DispatchTypes::CharacterSets::ASCII);
|
||||
break;
|
||||
case Vt52ActionCodes::CursorToHome:
|
||||
success = _dispatch->CursorPosition(1, 1);
|
||||
_dispatch->CursorPosition(1, 1);
|
||||
break;
|
||||
case Vt52ActionCodes::ReverseLineFeed:
|
||||
success = _dispatch->ReverseLineFeed();
|
||||
_dispatch->ReverseLineFeed();
|
||||
break;
|
||||
case Vt52ActionCodes::EraseToEndOfScreen:
|
||||
success = _dispatch->EraseInDisplay(DispatchTypes::EraseType::ToEnd);
|
||||
_dispatch->EraseInDisplay(DispatchTypes::EraseType::ToEnd);
|
||||
break;
|
||||
case Vt52ActionCodes::EraseToEndOfLine:
|
||||
success = _dispatch->EraseInLine(DispatchTypes::EraseType::ToEnd);
|
||||
_dispatch->EraseInLine(DispatchTypes::EraseType::ToEnd);
|
||||
break;
|
||||
case Vt52ActionCodes::DirectCursorAddress:
|
||||
// VT52 cursor addresses are provided as ASCII characters, with
|
||||
// the lowest value being a space, representing an address of 1.
|
||||
success = _dispatch->CursorPosition(parameters.at(0).value() - ' ' + 1, parameters.at(1).value() - ' ' + 1);
|
||||
_dispatch->CursorPosition(parameters.at(0).value() - ' ' + 1, parameters.at(1).value() - ' ' + 1);
|
||||
break;
|
||||
case Vt52ActionCodes::Identify:
|
||||
success = _dispatch->Vt52DeviceAttributes();
|
||||
_dispatch->Vt52DeviceAttributes();
|
||||
break;
|
||||
case Vt52ActionCodes::EnterAlternateKeypadMode:
|
||||
success = _dispatch->SetKeypadMode(true);
|
||||
_dispatch->SetKeypadMode(true);
|
||||
break;
|
||||
case Vt52ActionCodes::ExitAlternateKeypadMode:
|
||||
success = _dispatch->SetKeypadMode(false);
|
||||
_dispatch->SetKeypadMode(false);
|
||||
break;
|
||||
case Vt52ActionCodes::ExitVt52Mode:
|
||||
success = _dispatch->SetMode(DispatchTypes::ModeParams::DECANM_AnsiMode);
|
||||
_dispatch->SetMode(DispatchTypes::ModeParams::DECANM_AnsiMode);
|
||||
break;
|
||||
default:
|
||||
// If no functions to call, overall dispatch was a failure.
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
_ClearLastChar();
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -411,164 +402,171 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParamete
|
||||
// Bail out if we receive subparameters, but we don't accept them in the sequence.
|
||||
if (parameters.hasSubParams() && !_CanSeqAcceptSubParam(id, parameters)) [[unlikely]]
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto success = false;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case CsiActionCodes::CUU_CursorUp:
|
||||
success = _dispatch->CursorUp(parameters.at(0));
|
||||
_dispatch->CursorUp(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CUD_CursorDown:
|
||||
success = _dispatch->CursorDown(parameters.at(0));
|
||||
_dispatch->CursorDown(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CUF_CursorForward:
|
||||
success = _dispatch->CursorForward(parameters.at(0));
|
||||
_dispatch->CursorForward(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CUB_CursorBackward:
|
||||
success = _dispatch->CursorBackward(parameters.at(0));
|
||||
_dispatch->CursorBackward(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CNL_CursorNextLine:
|
||||
success = _dispatch->CursorNextLine(parameters.at(0));
|
||||
_dispatch->CursorNextLine(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CPL_CursorPrevLine:
|
||||
success = _dispatch->CursorPrevLine(parameters.at(0));
|
||||
_dispatch->CursorPrevLine(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CHA_CursorHorizontalAbsolute:
|
||||
case CsiActionCodes::HPA_HorizontalPositionAbsolute:
|
||||
success = _dispatch->CursorHorizontalPositionAbsolute(parameters.at(0));
|
||||
_dispatch->CursorHorizontalPositionAbsolute(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::VPA_VerticalLinePositionAbsolute:
|
||||
success = _dispatch->VerticalLinePositionAbsolute(parameters.at(0));
|
||||
_dispatch->VerticalLinePositionAbsolute(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::HPR_HorizontalPositionRelative:
|
||||
success = _dispatch->HorizontalPositionRelative(parameters.at(0));
|
||||
_dispatch->HorizontalPositionRelative(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::VPR_VerticalPositionRelative:
|
||||
success = _dispatch->VerticalPositionRelative(parameters.at(0));
|
||||
_dispatch->VerticalPositionRelative(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CUP_CursorPosition:
|
||||
case CsiActionCodes::HVP_HorizontalVerticalPosition:
|
||||
success = _dispatch->CursorPosition(parameters.at(0), parameters.at(1));
|
||||
_dispatch->CursorPosition(parameters.at(0), parameters.at(1));
|
||||
break;
|
||||
case CsiActionCodes::DECSTBM_SetTopBottomMargins:
|
||||
success = _dispatch->SetTopBottomScrollingMargins(parameters.at(0).value_or(0), parameters.at(1).value_or(0));
|
||||
_dispatch->SetTopBottomScrollingMargins(parameters.at(0).value_or(0), parameters.at(1).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECSLRM_SetLeftRightMargins:
|
||||
// Note that this can also be ANSISYSSC, depending on the state of DECLRMM.
|
||||
success = _dispatch->SetLeftRightScrollingMargins(parameters.at(0).value_or(0), parameters.at(1).value_or(0));
|
||||
_dispatch->SetLeftRightScrollingMargins(parameters.at(0).value_or(0), parameters.at(1).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::ICH_InsertCharacter:
|
||||
success = _dispatch->InsertCharacter(parameters.at(0));
|
||||
_dispatch->InsertCharacter(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DCH_DeleteCharacter:
|
||||
success = _dispatch->DeleteCharacter(parameters.at(0));
|
||||
_dispatch->DeleteCharacter(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::ED_EraseDisplay:
|
||||
success = parameters.for_each([&](const auto eraseType) {
|
||||
return _dispatch->EraseInDisplay(eraseType);
|
||||
parameters.for_each([&](const auto eraseType) {
|
||||
_dispatch->EraseInDisplay(eraseType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::DECSED_SelectiveEraseDisplay:
|
||||
success = parameters.for_each([&](const auto eraseType) {
|
||||
return _dispatch->SelectiveEraseInDisplay(eraseType);
|
||||
parameters.for_each([&](const auto eraseType) {
|
||||
_dispatch->SelectiveEraseInDisplay(eraseType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::EL_EraseLine:
|
||||
success = parameters.for_each([&](const auto eraseType) {
|
||||
return _dispatch->EraseInLine(eraseType);
|
||||
parameters.for_each([&](const auto eraseType) {
|
||||
_dispatch->EraseInLine(eraseType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::DECSEL_SelectiveEraseLine:
|
||||
success = parameters.for_each([&](const auto eraseType) {
|
||||
return _dispatch->SelectiveEraseInLine(eraseType);
|
||||
parameters.for_each([&](const auto eraseType) {
|
||||
_dispatch->SelectiveEraseInLine(eraseType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::SM_SetMode:
|
||||
success = parameters.for_each([&](const auto mode) {
|
||||
return _dispatch->SetMode(DispatchTypes::ANSIStandardMode(mode));
|
||||
parameters.for_each([&](const auto mode) {
|
||||
_dispatch->SetMode(DispatchTypes::ANSIStandardMode(mode));
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::DECSET_PrivateModeSet:
|
||||
success = parameters.for_each([&](const auto mode) {
|
||||
return _dispatch->SetMode(DispatchTypes::DECPrivateMode(mode));
|
||||
parameters.for_each([&](const auto mode) {
|
||||
_dispatch->SetMode(DispatchTypes::DECPrivateMode(mode));
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::RM_ResetMode:
|
||||
success = parameters.for_each([&](const auto mode) {
|
||||
return _dispatch->ResetMode(DispatchTypes::ANSIStandardMode(mode));
|
||||
parameters.for_each([&](const auto mode) {
|
||||
_dispatch->ResetMode(DispatchTypes::ANSIStandardMode(mode));
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::DECRST_PrivateModeReset:
|
||||
success = parameters.for_each([&](const auto mode) {
|
||||
return _dispatch->ResetMode(DispatchTypes::DECPrivateMode(mode));
|
||||
parameters.for_each([&](const auto mode) {
|
||||
_dispatch->ResetMode(DispatchTypes::DECPrivateMode(mode));
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::SGR_SetGraphicsRendition:
|
||||
success = _dispatch->SetGraphicsRendition(parameters);
|
||||
_dispatch->SetGraphicsRendition(parameters);
|
||||
break;
|
||||
case CsiActionCodes::DSR_DeviceStatusReport:
|
||||
success = _dispatch->DeviceStatusReport(DispatchTypes::ANSIStandardStatus(parameters.at(0)), parameters.at(1));
|
||||
_dispatch->DeviceStatusReport(DispatchTypes::ANSIStandardStatus(parameters.at(0)), parameters.at(1));
|
||||
break;
|
||||
case CsiActionCodes::DSR_PrivateDeviceStatusReport:
|
||||
success = _dispatch->DeviceStatusReport(DispatchTypes::DECPrivateStatus(parameters.at(0)), parameters.at(1));
|
||||
_dispatch->DeviceStatusReport(DispatchTypes::DECPrivateStatus(parameters.at(0)), parameters.at(1));
|
||||
break;
|
||||
case CsiActionCodes::DA_DeviceAttributes:
|
||||
success = parameters.at(0).value_or(0) == 0 && _dispatch->DeviceAttributes();
|
||||
if (parameters.at(0).value_or(0) == 0)
|
||||
{
|
||||
_dispatch->DeviceAttributes();
|
||||
}
|
||||
break;
|
||||
case CsiActionCodes::DA2_SecondaryDeviceAttributes:
|
||||
success = parameters.at(0).value_or(0) == 0 && _dispatch->SecondaryDeviceAttributes();
|
||||
if (parameters.at(0).value_or(0) == 0)
|
||||
{
|
||||
_dispatch->SecondaryDeviceAttributes();
|
||||
}
|
||||
break;
|
||||
case CsiActionCodes::DA3_TertiaryDeviceAttributes:
|
||||
success = parameters.at(0).value_or(0) == 0 && _dispatch->TertiaryDeviceAttributes();
|
||||
if (parameters.at(0).value_or(0) == 0)
|
||||
{
|
||||
_dispatch->TertiaryDeviceAttributes();
|
||||
}
|
||||
break;
|
||||
case CsiActionCodes::DECREQTPARM_RequestTerminalParameters:
|
||||
success = _dispatch->RequestTerminalParameters(parameters.at(0));
|
||||
_dispatch->RequestTerminalParameters(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::SU_ScrollUp:
|
||||
success = _dispatch->ScrollUp(parameters.at(0));
|
||||
_dispatch->ScrollUp(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::SD_ScrollDown:
|
||||
success = _dispatch->ScrollDown(parameters.at(0));
|
||||
_dispatch->ScrollDown(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::NP_NextPage:
|
||||
success = _dispatch->NextPage(parameters.at(0));
|
||||
_dispatch->NextPage(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::PP_PrecedingPage:
|
||||
success = _dispatch->PrecedingPage(parameters.at(0));
|
||||
_dispatch->PrecedingPage(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::ANSISYSRC_CursorRestore:
|
||||
success = _dispatch->CursorRestoreState();
|
||||
_dispatch->CursorRestoreState();
|
||||
break;
|
||||
case CsiActionCodes::IL_InsertLine:
|
||||
success = _dispatch->InsertLine(parameters.at(0));
|
||||
_dispatch->InsertLine(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DL_DeleteLine:
|
||||
success = _dispatch->DeleteLine(parameters.at(0));
|
||||
_dispatch->DeleteLine(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CHT_CursorForwardTab:
|
||||
success = _dispatch->ForwardTab(parameters.at(0));
|
||||
_dispatch->ForwardTab(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::CBT_CursorBackTab:
|
||||
success = _dispatch->BackwardsTab(parameters.at(0));
|
||||
_dispatch->BackwardsTab(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::TBC_TabClear:
|
||||
success = parameters.for_each([&](const auto clearType) {
|
||||
return _dispatch->TabClear(clearType);
|
||||
parameters.for_each([&](const auto clearType) {
|
||||
_dispatch->TabClear(clearType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::DECST8C_SetTabEvery8Columns:
|
||||
success = parameters.for_each([&](const auto setType) {
|
||||
return _dispatch->TabSet(setType);
|
||||
parameters.for_each([&](const auto setType) {
|
||||
_dispatch->TabSet(setType);
|
||||
});
|
||||
break;
|
||||
case CsiActionCodes::ECH_EraseCharacters:
|
||||
success = _dispatch->EraseCharacters(parameters.at(0));
|
||||
_dispatch->EraseCharacters(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DTTERM_WindowManipulation:
|
||||
success = _dispatch->WindowManipulation(parameters.at(0), parameters.at(1), parameters.at(2));
|
||||
_dispatch->WindowManipulation(parameters.at(0), parameters.at(1), parameters.at(2));
|
||||
break;
|
||||
case CsiActionCodes::REP_RepeatCharacter:
|
||||
// Handled w/o the dispatch. This function is unique in that way
|
||||
@ -582,100 +580,97 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const VTID id, const VTParamete
|
||||
std::wstring wstr(repeatCount, _lastPrintedChar);
|
||||
_dispatch->PrintString(wstr);
|
||||
}
|
||||
success = true;
|
||||
break;
|
||||
case CsiActionCodes::PPA_PagePositionAbsolute:
|
||||
success = _dispatch->PagePositionAbsolute(parameters.at(0));
|
||||
_dispatch->PagePositionAbsolute(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::PPR_PagePositionRelative:
|
||||
success = _dispatch->PagePositionRelative(parameters.at(0));
|
||||
_dispatch->PagePositionRelative(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::PPB_PagePositionBack:
|
||||
success = _dispatch->PagePositionBack(parameters.at(0));
|
||||
_dispatch->PagePositionBack(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECSCUSR_SetCursorStyle:
|
||||
success = _dispatch->SetCursorStyle(parameters.at(0));
|
||||
_dispatch->SetCursorStyle(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECSTR_SoftReset:
|
||||
success = _dispatch->SoftReset();
|
||||
_dispatch->SoftReset();
|
||||
break;
|
||||
case CsiActionCodes::DECSCA_SetCharacterProtectionAttribute:
|
||||
success = _dispatch->SetCharacterProtectionAttribute(parameters);
|
||||
_dispatch->SetCharacterProtectionAttribute(parameters);
|
||||
break;
|
||||
case CsiActionCodes::DECRQDE_RequestDisplayedExtent:
|
||||
success = _dispatch->RequestDisplayedExtent();
|
||||
_dispatch->RequestDisplayedExtent();
|
||||
break;
|
||||
case CsiActionCodes::XT_PushSgr:
|
||||
case CsiActionCodes::XT_PushSgrAlias:
|
||||
success = _dispatch->PushGraphicsRendition(parameters);
|
||||
_dispatch->PushGraphicsRendition(parameters);
|
||||
break;
|
||||
case CsiActionCodes::XT_PopSgr:
|
||||
case CsiActionCodes::XT_PopSgrAlias:
|
||||
success = _dispatch->PopGraphicsRendition();
|
||||
_dispatch->PopGraphicsRendition();
|
||||
break;
|
||||
case CsiActionCodes::DECRQM_RequestMode:
|
||||
success = _dispatch->RequestMode(DispatchTypes::ANSIStandardMode(parameters.at(0)));
|
||||
_dispatch->RequestMode(DispatchTypes::ANSIStandardMode(parameters.at(0)));
|
||||
break;
|
||||
case CsiActionCodes::DECRQM_PrivateRequestMode:
|
||||
success = _dispatch->RequestMode(DispatchTypes::DECPrivateMode(parameters.at(0)));
|
||||
_dispatch->RequestMode(DispatchTypes::DECPrivateMode(parameters.at(0)));
|
||||
break;
|
||||
case CsiActionCodes::DECCARA_ChangeAttributesRectangularArea:
|
||||
success = _dispatch->ChangeAttributesRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.subspan(4));
|
||||
_dispatch->ChangeAttributesRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.subspan(4));
|
||||
break;
|
||||
case CsiActionCodes::DECRARA_ReverseAttributesRectangularArea:
|
||||
success = _dispatch->ReverseAttributesRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.subspan(4));
|
||||
_dispatch->ReverseAttributesRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.subspan(4));
|
||||
break;
|
||||
case CsiActionCodes::DECCRA_CopyRectangularArea:
|
||||
success = _dispatch->CopyRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.at(4), parameters.at(5), parameters.at(6), parameters.at(7));
|
||||
_dispatch->CopyRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0), parameters.at(4), parameters.at(5), parameters.at(6), parameters.at(7));
|
||||
break;
|
||||
case CsiActionCodes::DECRQTSR_RequestTerminalStateReport:
|
||||
success = _dispatch->RequestTerminalStateReport(parameters.at(0), parameters.at(1));
|
||||
_dispatch->RequestTerminalStateReport(parameters.at(0), parameters.at(1));
|
||||
break;
|
||||
case CsiActionCodes::DECRQPSR_RequestPresentationStateReport:
|
||||
success = _dispatch->RequestPresentationStateReport(parameters.at(0));
|
||||
_dispatch->RequestPresentationStateReport(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECFRA_FillRectangularArea:
|
||||
success = _dispatch->FillRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2), parameters.at(3).value_or(0), parameters.at(4).value_or(0));
|
||||
_dispatch->FillRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2), parameters.at(3).value_or(0), parameters.at(4).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECERA_EraseRectangularArea:
|
||||
success = _dispatch->EraseRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0));
|
||||
_dispatch->EraseRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECSERA_SelectiveEraseRectangularArea:
|
||||
success = _dispatch->SelectiveEraseRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0));
|
||||
_dispatch->SelectiveEraseRectangularArea(parameters.at(0), parameters.at(1), parameters.at(2).value_or(0), parameters.at(3).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECRQUPSS_RequestUserPreferenceSupplementalSet:
|
||||
success = _dispatch->RequestUserPreferenceCharset();
|
||||
_dispatch->RequestUserPreferenceCharset();
|
||||
break;
|
||||
case CsiActionCodes::DECIC_InsertColumn:
|
||||
success = _dispatch->InsertColumn(parameters.at(0));
|
||||
_dispatch->InsertColumn(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECDC_DeleteColumn:
|
||||
success = _dispatch->DeleteColumn(parameters.at(0));
|
||||
_dispatch->DeleteColumn(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECSACE_SelectAttributeChangeExtent:
|
||||
success = _dispatch->SelectAttributeChangeExtent(parameters.at(0));
|
||||
_dispatch->SelectAttributeChangeExtent(parameters.at(0));
|
||||
break;
|
||||
case CsiActionCodes::DECRQCRA_RequestChecksumRectangularArea:
|
||||
success = _dispatch->RequestChecksumRectangularArea(parameters.at(0).value_or(0), parameters.at(1).value_or(0), parameters.at(2), parameters.at(3), parameters.at(4).value_or(0), parameters.at(5).value_or(0));
|
||||
_dispatch->RequestChecksumRectangularArea(parameters.at(0).value_or(0), parameters.at(1).value_or(0), parameters.at(2), parameters.at(3), parameters.at(4).value_or(0), parameters.at(5).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECINVM_InvokeMacro:
|
||||
success = _dispatch->InvokeMacro(parameters.at(0).value_or(0));
|
||||
_dispatch->InvokeMacro(parameters.at(0).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECAC_AssignColor:
|
||||
success = _dispatch->AssignColor(parameters.at(0), parameters.at(1).value_or(0), parameters.at(2).value_or(0));
|
||||
_dispatch->AssignColor(parameters.at(0), parameters.at(1).value_or(0), parameters.at(2).value_or(0));
|
||||
break;
|
||||
case CsiActionCodes::DECPS_PlaySound:
|
||||
success = _dispatch->PlaySounds(parameters);
|
||||
_dispatch->PlaySounds(parameters);
|
||||
break;
|
||||
default:
|
||||
// If no functions to call, overall dispatch was a failure.
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
_ClearLastChar();
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -733,32 +728,6 @@ IStateMachineEngine::StringHandler OutputStateMachineEngine::ActionDcsDispatch(c
|
||||
return handler;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Triggers the Clear action to indicate that the state machine should erase
|
||||
// all internal state.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
bool OutputStateMachineEngine::ActionClear() noexcept
|
||||
{
|
||||
// do nothing.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Triggers the Ignore action to indicate that the state machine should eat
|
||||
// this character and say nothing.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
bool OutputStateMachineEngine::ActionIgnore() noexcept
|
||||
{
|
||||
// do nothing.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Triggers the OscDispatch action to indicate that the listener should handle a control sequence.
|
||||
// These sequences perform various API-type commands that can include many parameters.
|
||||
@ -769,8 +738,6 @@ bool OutputStateMachineEngine::ActionIgnore() noexcept
|
||||
// - true if we handled the dispatch.
|
||||
bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const std::wstring_view string)
|
||||
{
|
||||
auto success = false;
|
||||
|
||||
switch (parameter)
|
||||
{
|
||||
case OscActionCodes::SetIconAndWindowTitle:
|
||||
@ -778,25 +745,27 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
|
||||
case OscActionCodes::SetWindowTitle:
|
||||
case OscActionCodes::DECSWT_SetWindowTitle:
|
||||
{
|
||||
success = _dispatch->SetWindowTitle(string);
|
||||
_dispatch->SetWindowTitle(string);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::SetColor:
|
||||
{
|
||||
std::vector<size_t> tableIndexes;
|
||||
std::vector<DWORD> colors;
|
||||
success = _GetOscSetColorTable(string, tableIndexes, colors);
|
||||
for (size_t i = 0; i < tableIndexes.size(); i++)
|
||||
if (_GetOscSetColorTable(string, tableIndexes, colors))
|
||||
{
|
||||
const auto tableIndex = til::at(tableIndexes, i);
|
||||
const auto rgb = til::at(colors, i);
|
||||
if (rgb == COLOR_INQUIRY_COLOR)
|
||||
for (size_t i = 0; i < tableIndexes.size(); i++)
|
||||
{
|
||||
success = success && _dispatch->RequestColorTableEntry(tableIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = success && _dispatch->SetColorTableEntry(tableIndex, rgb);
|
||||
const auto tableIndex = til::at(tableIndexes, i);
|
||||
const auto rgb = til::at(colors, i);
|
||||
if (rgb == COLOR_INQUIRY_COLOR)
|
||||
{
|
||||
_dispatch->RequestColorTableEntry(tableIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
_dispatch->SetColorTableEntry(tableIndex, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -807,19 +776,18 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
|
||||
case OscActionCodes::SetHighlightColor:
|
||||
{
|
||||
std::vector<DWORD> colors;
|
||||
success = _GetOscSetColor(string, colors);
|
||||
if (success)
|
||||
if (_GetOscSetColor(string, colors))
|
||||
{
|
||||
auto resource = parameter;
|
||||
for (auto&& color : colors)
|
||||
{
|
||||
if (color == COLOR_INQUIRY_COLOR)
|
||||
{
|
||||
success = success && _dispatch->RequestXtermColorResource(resource);
|
||||
_dispatch->RequestXtermColorResource(resource);
|
||||
}
|
||||
else if (color != INVALID_COLOR)
|
||||
{
|
||||
success = success && _dispatch->SetXtermColorResource(resource, color);
|
||||
_dispatch->SetXtermColorResource(resource, color);
|
||||
}
|
||||
resource++;
|
||||
}
|
||||
@ -830,68 +798,67 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
|
||||
{
|
||||
std::wstring setClipboardContent;
|
||||
auto queryClipboard = false;
|
||||
success = _GetOscSetClipboard(string, setClipboardContent, queryClipboard);
|
||||
if (success && !queryClipboard)
|
||||
if (_GetOscSetClipboard(string, setClipboardContent, queryClipboard) && !queryClipboard)
|
||||
{
|
||||
success = _dispatch->SetClipboard(setClipboardContent);
|
||||
_dispatch->SetClipboard(setClipboardContent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::ResetCursorColor:
|
||||
{
|
||||
/* The reset codes for xterm dynamic resources are the set codes + 100 */
|
||||
success = _dispatch->SetXtermColorResource(parameter - 100u, INVALID_COLOR);
|
||||
// The reset codes for xterm dynamic resources are the set codes + 100
|
||||
_dispatch->SetXtermColorResource(parameter - 100u, INVALID_COLOR);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::Hyperlink:
|
||||
{
|
||||
std::wstring params;
|
||||
std::wstring uri;
|
||||
success = _ParseHyperlink(string, params, uri);
|
||||
if (uri.empty())
|
||||
if (_ParseHyperlink(string, params, uri))
|
||||
{
|
||||
success = success && _dispatch->EndHyperlink();
|
||||
}
|
||||
else
|
||||
{
|
||||
success = success && _dispatch->AddHyperlink(uri, params);
|
||||
if (uri.empty())
|
||||
{
|
||||
_dispatch->EndHyperlink();
|
||||
}
|
||||
else
|
||||
{
|
||||
_dispatch->AddHyperlink(uri, params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::ConEmuAction:
|
||||
{
|
||||
success = _dispatch->DoConEmuAction(string);
|
||||
_dispatch->DoConEmuAction(string);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::ITerm2Action:
|
||||
{
|
||||
success = _dispatch->DoITerm2Action(string);
|
||||
_dispatch->DoITerm2Action(string);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::FinalTermAction:
|
||||
{
|
||||
success = _dispatch->DoFinalTermAction(string);
|
||||
_dispatch->DoFinalTermAction(string);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::VsCodeAction:
|
||||
{
|
||||
success = _dispatch->DoVsCodeAction(string);
|
||||
_dispatch->DoVsCodeAction(string);
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::WTAction:
|
||||
{
|
||||
success = _dispatch->DoWTAction(string);
|
||||
_dispatch->DoWTAction(string);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// If no functions to call, overall dispatch was a failure.
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
|
||||
_ClearLastChar();
|
||||
|
||||
return success;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -907,7 +874,7 @@ bool OutputStateMachineEngine::ActionSs3Dispatch(const wchar_t /*wch*/, const VT
|
||||
{
|
||||
// The output engine doesn't handle any SS3 sequences.
|
||||
_ClearLastChar();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
bool ActionPrintString(const std::wstring_view string) override;
|
||||
|
||||
bool ActionPassThroughString(const std::wstring_view string, const bool flush) noexcept override;
|
||||
bool ActionPassThroughString(const std::wstring_view string) noexcept override;
|
||||
|
||||
bool ActionEscDispatch(const VTID id) override;
|
||||
|
||||
@ -43,10 +43,6 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
StringHandler ActionDcsDispatch(const VTID id, const VTParameters parameters) override;
|
||||
|
||||
bool ActionClear() noexcept override;
|
||||
|
||||
bool ActionIgnore() noexcept override;
|
||||
|
||||
bool ActionOscDispatch(const size_t parameter, const std::wstring_view string) override;
|
||||
|
||||
bool ActionSs3Dispatch(const wchar_t wch, const VTParameters parameters) noexcept override;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
using namespace Microsoft::Console::VirtualTerminal;
|
||||
|
||||
//Takes ownership of the pEngine.
|
||||
StateMachine::StateMachine(std::unique_ptr<IStateMachineEngine> engine, const bool isEngineForInput) :
|
||||
StateMachine::StateMachine(std::unique_ptr<IStateMachineEngine> engine, const bool isEngineForInput) noexcept :
|
||||
_engine(std::move(engine)),
|
||||
_isEngineForInput(isEngineForInput),
|
||||
_state(VTStates::Ground),
|
||||
@ -606,7 +606,7 @@ void StateMachine::_ActionSubParam(const wchar_t wch)
|
||||
// - wch - Character to dispatch.
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void StateMachine::_ActionClear()
|
||||
void StateMachine::_ActionClear() noexcept
|
||||
{
|
||||
_trace.TraceOnAction(L"Clear");
|
||||
|
||||
@ -625,8 +625,6 @@ void StateMachine::_ActionClear()
|
||||
_oscParameter = 0;
|
||||
|
||||
_dcsStringHandler = nullptr;
|
||||
|
||||
_engine->ActionClear();
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
@ -728,14 +726,14 @@ void StateMachine::_ActionDcsDispatch(const wchar_t wch)
|
||||
|
||||
const auto success = _SafeExecute([=]() {
|
||||
_dcsStringHandler = _engine->ActionDcsDispatch(_identifier.Finalize(wch), { _parameters.data(), _parameters.size() });
|
||||
// If the returned handler is null, the sequence is not supported.
|
||||
return _dcsStringHandler != nullptr;
|
||||
return true;
|
||||
});
|
||||
|
||||
// Trace the result.
|
||||
_trace.DispatchSequenceTrace(success);
|
||||
|
||||
if (success)
|
||||
// If the returned handler is null, the sequence is not supported.
|
||||
if (_dcsStringHandler)
|
||||
{
|
||||
// If successful, enter the pass through state.
|
||||
_EnterDcsPassThrough();
|
||||
@ -771,7 +769,7 @@ void StateMachine::_EnterGround() noexcept
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void StateMachine::_EnterEscape()
|
||||
void StateMachine::_EnterEscape() noexcept
|
||||
{
|
||||
_state = VTStates::Escape;
|
||||
_trace.TraceStateChange(L"Escape");
|
||||
@ -801,7 +799,7 @@ void StateMachine::_EnterEscapeIntermediate() noexcept
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void StateMachine::_EnterCsiEntry()
|
||||
void StateMachine::_EnterCsiEntry() noexcept
|
||||
{
|
||||
_state = VTStates::CsiEntry;
|
||||
_trace.TraceStateChange(L"CsiEntry");
|
||||
@ -917,7 +915,7 @@ void StateMachine::_EnterOscTermination() noexcept
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void StateMachine::_EnterSs3Entry()
|
||||
void StateMachine::_EnterSs3Entry() noexcept
|
||||
{
|
||||
_state = VTStates::Ss3Entry;
|
||||
_trace.TraceStateChange(L"Ss3Entry");
|
||||
@ -960,7 +958,7 @@ void StateMachine::_EnterVt52Param() noexcept
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void StateMachine::_EnterDcsEntry()
|
||||
void StateMachine::_EnterDcsEntry() noexcept
|
||||
{
|
||||
_state = VTStates::DcsEntry;
|
||||
_trace.TraceStateChange(L"DcsEntry");
|
||||
@ -2169,11 +2167,13 @@ template<typename TLambda>
|
||||
bool StateMachine::_SafeExecute(TLambda&& lambda)
|
||||
try
|
||||
{
|
||||
return lambda();
|
||||
}
|
||||
catch (const ShutdownException&)
|
||||
{
|
||||
throw;
|
||||
const auto ok = lambda();
|
||||
static_assert(std::is_same_v<decltype(ok), const bool>, "lambda must return bool");
|
||||
if (!ok)
|
||||
{
|
||||
FlushToTerminal();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
||||
@ -64,11 +64,11 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
StateMachine(std::unique_ptr<T> engine) :
|
||||
StateMachine(std::unique_ptr<T> engine) noexcept :
|
||||
StateMachine(std::move(engine), std::is_same_v<T, class InputStateMachineEngine>)
|
||||
{
|
||||
}
|
||||
StateMachine(std::unique_ptr<IStateMachineEngine> engine, const bool isEngineForInput);
|
||||
StateMachine(std::unique_ptr<IStateMachineEngine> engine, const bool isEngineForInput) noexcept;
|
||||
|
||||
enum class Mode : size_t
|
||||
{
|
||||
@ -93,13 +93,6 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
const IStateMachineEngine& Engine() const noexcept;
|
||||
IStateMachineEngine& Engine() noexcept;
|
||||
|
||||
class ShutdownException : public wil::ResultException
|
||||
{
|
||||
public:
|
||||
ShutdownException() noexcept :
|
||||
ResultException(E_ABORT) {}
|
||||
};
|
||||
|
||||
private:
|
||||
void _ActionExecute(const wchar_t wch);
|
||||
void _ActionExecuteFromEscape(const wchar_t wch);
|
||||
@ -117,14 +110,14 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
void _ActionSs3Dispatch(const wchar_t wch);
|
||||
void _ActionDcsDispatch(const wchar_t wch);
|
||||
|
||||
void _ActionClear();
|
||||
void _ActionClear() noexcept;
|
||||
void _ActionIgnore() noexcept;
|
||||
void _ActionInterrupt();
|
||||
|
||||
void _EnterGround() noexcept;
|
||||
void _EnterEscape();
|
||||
void _EnterEscape() noexcept;
|
||||
void _EnterEscapeIntermediate() noexcept;
|
||||
void _EnterCsiEntry();
|
||||
void _EnterCsiEntry() noexcept;
|
||||
void _EnterCsiParam() noexcept;
|
||||
void _EnterCsiSubParam() noexcept;
|
||||
void _EnterCsiIgnore() noexcept;
|
||||
@ -132,10 +125,10 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
void _EnterOscParam() noexcept;
|
||||
void _EnterOscString() noexcept;
|
||||
void _EnterOscTermination() noexcept;
|
||||
void _EnterSs3Entry();
|
||||
void _EnterSs3Entry() noexcept;
|
||||
void _EnterSs3Param() noexcept;
|
||||
void _EnterVt52Param() noexcept;
|
||||
void _EnterDcsEntry();
|
||||
void _EnterDcsEntry() noexcept;
|
||||
void _EnterDcsParam() noexcept;
|
||||
void _EnterDcsIgnore() noexcept;
|
||||
void _EnterDcsIntermediate() noexcept;
|
||||
|
||||
@ -250,7 +250,6 @@ class Microsoft::Console::VirtualTerminal::InputEngineTest
|
||||
TEST_METHOD(C0Test);
|
||||
TEST_METHOD(AlphanumericTest);
|
||||
TEST_METHOD(RoundTripTest);
|
||||
TEST_METHOD(WindowManipulationTest);
|
||||
TEST_METHOD(NonAsciiTest);
|
||||
TEST_METHOD(CursorPositioningTest);
|
||||
TEST_METHOD(CSICursorBackTabTest);
|
||||
@ -316,20 +315,20 @@ class Microsoft::Console::VirtualTerminal::TestInteractDispatch final : public I
|
||||
public:
|
||||
TestInteractDispatch(_In_ std::function<void(const std::span<const INPUT_RECORD>&)> pfn,
|
||||
_In_ TestState* testState);
|
||||
virtual bool WriteInput(_In_ const std::span<const INPUT_RECORD>& inputEvents) override;
|
||||
virtual void WriteInput(_In_ const std::span<const INPUT_RECORD>& inputEvents) override;
|
||||
|
||||
virtual bool WriteCtrlKey(const INPUT_RECORD& event) override;
|
||||
virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
virtual void WriteCtrlKey(const INPUT_RECORD& event) override;
|
||||
virtual void WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2) override; // DTTERM_WindowManipulation
|
||||
virtual bool WriteString(const std::wstring_view string) override;
|
||||
virtual void WriteString(const std::wstring_view string) override;
|
||||
|
||||
virtual bool MoveCursor(const VTInt row,
|
||||
virtual void MoveCursor(const VTInt row,
|
||||
const VTInt col) override;
|
||||
|
||||
virtual bool IsVtInputEnabled() const override;
|
||||
|
||||
virtual bool FocusChanged(const bool focused) const override;
|
||||
virtual void FocusChanged(const bool focused) override;
|
||||
|
||||
private:
|
||||
std::function<void(const std::span<const INPUT_RECORD>&)> _pfnWriteInputCallback;
|
||||
@ -343,19 +342,18 @@ TestInteractDispatch::TestInteractDispatch(_In_ std::function<void(const std::sp
|
||||
{
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::WriteInput(_In_ const std::span<const INPUT_RECORD>& inputEvents)
|
||||
void TestInteractDispatch::WriteInput(_In_ const std::span<const INPUT_RECORD>& inputEvents)
|
||||
{
|
||||
_pfnWriteInputCallback(inputEvents);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::WriteCtrlKey(const INPUT_RECORD& event)
|
||||
void TestInteractDispatch::WriteCtrlKey(const INPUT_RECORD& event)
|
||||
{
|
||||
VERIFY_IS_TRUE(_testState->_expectSendCtrlC);
|
||||
return WriteInput({ &event, 1 });
|
||||
WriteInput({ &event, 1 });
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
void TestInteractDispatch::WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
const VTParameter parameter1,
|
||||
const VTParameter parameter2)
|
||||
{
|
||||
@ -363,10 +361,9 @@ bool TestInteractDispatch::WindowManipulation(const DispatchTypes::WindowManipul
|
||||
VERIFY_ARE_EQUAL(_testState->_expectedWindowManipulation, function);
|
||||
VERIFY_ARE_EQUAL(_testState->_expectedParams[0], parameter1.value_or(0));
|
||||
VERIFY_ARE_EQUAL(_testState->_expectedParams[1], parameter2.value_or(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::WriteString(const std::wstring_view string)
|
||||
void TestInteractDispatch::WriteString(const std::wstring_view string)
|
||||
{
|
||||
InputEventQueue keyEvents;
|
||||
|
||||
@ -377,25 +374,23 @@ bool TestInteractDispatch::WriteString(const std::wstring_view string)
|
||||
Microsoft::Console::Interactivity::CharToKeyEvents(wch, CP_USA, keyEvents);
|
||||
}
|
||||
|
||||
return WriteInput(keyEvents);
|
||||
WriteInput(keyEvents);
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::MoveCursor(const VTInt row, const VTInt col)
|
||||
void TestInteractDispatch::MoveCursor(const VTInt row, const VTInt col)
|
||||
{
|
||||
VERIFY_IS_TRUE(_testState->_expectCursorPosition);
|
||||
til::point received{ col, row };
|
||||
VERIFY_ARE_EQUAL(_testState->_expectedCursor, received);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::IsVtInputEnabled() const
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestInteractDispatch::FocusChanged(const bool /*focused*/) const
|
||||
void TestInteractDispatch::FocusChanged(const bool /*focused*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void InputEngineTest::C0Test()
|
||||
@ -612,60 +607,6 @@ void InputEngineTest::RoundTripTest()
|
||||
*/
|
||||
}
|
||||
|
||||
void InputEngineTest::WindowManipulationTest()
|
||||
{
|
||||
auto pfn = std::bind(&TestState::TestInputCallback, &testState, std::placeholders::_1);
|
||||
auto dispatch = std::make_unique<TestInteractDispatch>(pfn, &testState);
|
||||
auto inputEngine = std::make_unique<InputStateMachineEngine>(std::move(dispatch));
|
||||
auto _stateMachine = std::make_unique<StateMachine>(std::move(inputEngine));
|
||||
VERIFY_IS_NOT_NULL(_stateMachine.get());
|
||||
testState._stateMachine = _stateMachine.get();
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Try sending a bunch of Window Manipulation sequences. "
|
||||
L"Only the valid ones should call the "
|
||||
L"TestInteractDispatch::WindowManipulation callback."));
|
||||
|
||||
const auto param1 = 123;
|
||||
const auto param2 = 456;
|
||||
const auto wszParam1 = L"123";
|
||||
const auto wszParam2 = L"456";
|
||||
|
||||
for (unsigned int i = 0; i < static_cast<unsigned int>(BYTE_MAX); i++)
|
||||
{
|
||||
std::wstringstream seqBuilder;
|
||||
seqBuilder << L"\x1b[" << i;
|
||||
|
||||
if (i == DispatchTypes::WindowManipulationType::ResizeWindowInCharacters)
|
||||
{
|
||||
// We need to build the string with the params as strings for some reason -
|
||||
// x86 would implicitly convert them to chars (eg 123 -> '{')
|
||||
// before appending them to the string
|
||||
seqBuilder << L";" << wszParam1 << L";" << wszParam2;
|
||||
|
||||
testState._expectedToCallWindowManipulation = true;
|
||||
testState._expectedParams[0] = param1;
|
||||
testState._expectedParams[1] = param2;
|
||||
testState._expectedWindowManipulation = static_cast<DispatchTypes::WindowManipulationType>(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
// other operations don't expect any params.
|
||||
|
||||
testState._expectedToCallWindowManipulation = true;
|
||||
testState._expectedParams[0] = 0;
|
||||
testState._expectedParams[1] = 0;
|
||||
testState._expectedWindowManipulation = static_cast<DispatchTypes::WindowManipulationType>(i);
|
||||
}
|
||||
seqBuilder << L"t";
|
||||
auto seq = seqBuilder.str();
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Processing \"%s\"", seq.c_str()));
|
||||
_stateMachine->ProcessString(seq);
|
||||
}
|
||||
VerifyExpectedInputDrained();
|
||||
}
|
||||
|
||||
void InputEngineTest::NonAsciiTest()
|
||||
{
|
||||
auto pfn = std::bind(&TestState::TestInputStringCallback, &testState, std::placeholders::_1);
|
||||
|
||||
@ -1173,128 +1173,110 @@ public:
|
||||
*this = dispatch;
|
||||
}
|
||||
|
||||
bool CursorUp(const VTInt uiDistance) noexcept override
|
||||
void CursorUp(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorUp = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorDown(const VTInt uiDistance) noexcept override
|
||||
void CursorDown(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorDown = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorBackward(const VTInt uiDistance) noexcept override
|
||||
void CursorBackward(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorBackward = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorForward(const VTInt uiDistance) noexcept override
|
||||
void CursorForward(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorForward = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorNextLine(const VTInt uiDistance) noexcept override
|
||||
void CursorNextLine(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorNextLine = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorPrevLine(const VTInt uiDistance) noexcept override
|
||||
void CursorPrevLine(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_cursorPreviousLine = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorHorizontalPositionAbsolute(const VTInt uiPosition) noexcept override
|
||||
void CursorHorizontalPositionAbsolute(const VTInt uiPosition) noexcept override
|
||||
{
|
||||
_cursorHorizontalPositionAbsolute = true;
|
||||
_cursorDistance = uiPosition;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VerticalLinePositionAbsolute(const VTInt uiPosition) noexcept override
|
||||
void VerticalLinePositionAbsolute(const VTInt uiPosition) noexcept override
|
||||
{
|
||||
_verticalLinePositionAbsolute = true;
|
||||
_cursorDistance = uiPosition;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HorizontalPositionRelative(const VTInt uiDistance) noexcept override
|
||||
void HorizontalPositionRelative(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_horizontalPositionRelative = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool VerticalPositionRelative(const VTInt uiDistance) noexcept override
|
||||
void VerticalPositionRelative(const VTInt uiDistance) noexcept override
|
||||
{
|
||||
_verticalPositionRelative = true;
|
||||
_cursorDistance = uiDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorPosition(const VTInt uiLine, const VTInt uiColumn) noexcept override
|
||||
void CursorPosition(const VTInt uiLine, const VTInt uiColumn) noexcept override
|
||||
{
|
||||
_cursorPosition = true;
|
||||
_line = uiLine;
|
||||
_column = uiColumn;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorSaveState() noexcept override
|
||||
void CursorSaveState() noexcept override
|
||||
{
|
||||
_cursorSave = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CursorRestoreState() noexcept override
|
||||
void CursorRestoreState() noexcept override
|
||||
{
|
||||
_cursorLoad = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EraseInDisplay(const DispatchTypes::EraseType eraseType) noexcept override
|
||||
void EraseInDisplay(const DispatchTypes::EraseType eraseType) noexcept override
|
||||
{
|
||||
_eraseDisplay = true;
|
||||
_eraseType = eraseType;
|
||||
_eraseTypes.push_back(eraseType);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EraseInLine(const DispatchTypes::EraseType eraseType) noexcept override
|
||||
void EraseInLine(const DispatchTypes::EraseType eraseType) noexcept override
|
||||
{
|
||||
_eraseLine = true;
|
||||
_eraseType = eraseType;
|
||||
_eraseTypes.push_back(eraseType);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InsertCharacter(const VTInt uiCount) noexcept override
|
||||
void InsertCharacter(const VTInt uiCount) noexcept override
|
||||
{
|
||||
_insertCharacter = true;
|
||||
_cursorDistance = uiCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeleteCharacter(const VTInt uiCount) noexcept override
|
||||
void DeleteCharacter(const VTInt uiCount) noexcept override
|
||||
{
|
||||
_deleteCharacter = true;
|
||||
_cursorDistance = uiCount;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetGraphicsRendition(const VTParameters options) noexcept override
|
||||
try
|
||||
void SetGraphicsRendition(const VTParameters options) noexcept override
|
||||
{
|
||||
_options.clear();
|
||||
for (size_t i = 0; i < options.size(); i++)
|
||||
@ -1302,158 +1284,129 @@ public:
|
||||
_options.push_back(options.at(i));
|
||||
}
|
||||
_setGraphics = true;
|
||||
return true;
|
||||
}
|
||||
CATCH_LOG_RETURN_FALSE()
|
||||
|
||||
bool DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter /*id*/) noexcept override
|
||||
void DeviceStatusReport(const DispatchTypes::StatusType statusType, const VTParameter /*id*/) noexcept override
|
||||
{
|
||||
_deviceStatusReport = true;
|
||||
_statusReportType = statusType;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeviceAttributes() noexcept override
|
||||
void DeviceAttributes() noexcept override
|
||||
{
|
||||
_deviceAttributes = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SecondaryDeviceAttributes() noexcept override
|
||||
void SecondaryDeviceAttributes() noexcept override
|
||||
{
|
||||
_secondaryDeviceAttributes = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TertiaryDeviceAttributes() noexcept override
|
||||
void TertiaryDeviceAttributes() noexcept override
|
||||
{
|
||||
_tertiaryDeviceAttributes = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Vt52DeviceAttributes() noexcept override
|
||||
void Vt52DeviceAttributes() noexcept override
|
||||
{
|
||||
_vt52DeviceAttributes = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) noexcept override
|
||||
void RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) noexcept override
|
||||
{
|
||||
_requestTerminalParameters = true;
|
||||
_reportingPermission = permission;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _ModeParamsHelper(_In_ DispatchTypes::ModeParams const param, const bool fEnable)
|
||||
void _ModeParamsHelper(_In_ DispatchTypes::ModeParams const param, const bool fEnable)
|
||||
{
|
||||
_modeType = param;
|
||||
_modeTypes.push_back(param);
|
||||
_modeEnabled = fEnable;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetMode(const DispatchTypes::ModeParams param) noexcept override
|
||||
void SetMode(const DispatchTypes::ModeParams param) noexcept override
|
||||
{
|
||||
return _ModeParamsHelper(param, true);
|
||||
_ModeParamsHelper(param, true);
|
||||
}
|
||||
|
||||
bool ResetMode(const DispatchTypes::ModeParams param) noexcept override
|
||||
void ResetMode(const DispatchTypes::ModeParams param) noexcept override
|
||||
{
|
||||
return _ModeParamsHelper(param, false);
|
||||
_ModeParamsHelper(param, false);
|
||||
}
|
||||
|
||||
bool SetAnsiMode(const bool ansiMode) noexcept override
|
||||
void SetAnsiMode(const bool ansiMode) noexcept override
|
||||
{
|
||||
_ModeParamsHelper(DispatchTypes::DECANM_AnsiMode, ansiMode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WarningBell() noexcept override
|
||||
void WarningBell() noexcept override
|
||||
{
|
||||
_warningBell = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CarriageReturn() noexcept override
|
||||
void CarriageReturn() noexcept override
|
||||
{
|
||||
_carriageReturn = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LineFeed(const DispatchTypes::LineFeedType lineFeedType) noexcept override
|
||||
void LineFeed(const DispatchTypes::LineFeedType lineFeedType) noexcept override
|
||||
{
|
||||
_lineFeed = true;
|
||||
_lineFeedType = lineFeedType;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReverseLineFeed() noexcept override
|
||||
void ReverseLineFeed() noexcept override
|
||||
{
|
||||
_reverseLineFeed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetWindowTitle(std::wstring_view title) override
|
||||
void SetWindowTitle(std::wstring_view title) override
|
||||
{
|
||||
_setWindowTitle = true;
|
||||
_setWindowTitleText = title;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ForwardTab(const VTInt numTabs) noexcept override
|
||||
void ForwardTab(const VTInt numTabs) noexcept override
|
||||
{
|
||||
_forwardTab = true;
|
||||
_numTabs = numTabs;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TabClear(const DispatchTypes::TabClearType clearType) noexcept override
|
||||
void TabClear(const DispatchTypes::TabClearType clearType) noexcept override
|
||||
{
|
||||
_tabClear = true;
|
||||
_tabClearTypes.push_back(clearType);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetColorTableEntry(const size_t tableIndex, const COLORREF color) noexcept override
|
||||
void SetColorTableEntry(const size_t tableIndex, const COLORREF color) noexcept override
|
||||
{
|
||||
_setColorTableEntry = true;
|
||||
_colorTable.at(tableIndex) = color;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RequestColorTableEntry(const size_t tableIndex) noexcept override
|
||||
void RequestColorTableEntry(const size_t tableIndex) noexcept override
|
||||
{
|
||||
_colorTableEntriesRequested.push_back(tableIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetXtermColorResource(const size_t resource, const DWORD color) override
|
||||
void SetXtermColorResource(const size_t resource, const DWORD color) override
|
||||
{
|
||||
_xtermResourcesChanged.push_back(resource);
|
||||
_xtermResourceValues.push_back(color);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RequestXtermColorResource(const size_t resource) override
|
||||
void RequestXtermColorResource(const size_t resource) override
|
||||
{
|
||||
_xtermResourcesRequested.push_back(resource);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetClipboard(wil::zwstring_view content) noexcept override
|
||||
void SetClipboard(wil::zwstring_view content) noexcept override
|
||||
{
|
||||
_copyContent = content;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddHyperlink(std::wstring_view uri, std::wstring_view params) noexcept override
|
||||
void AddHyperlink(std::wstring_view uri, std::wstring_view params) noexcept override
|
||||
{
|
||||
_hyperlinkMode = true;
|
||||
_uri = uri;
|
||||
@ -1461,20 +1414,17 @@ public:
|
||||
{
|
||||
_customId = params;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EndHyperlink() noexcept override
|
||||
void EndHyperlink() noexcept override
|
||||
{
|
||||
_hyperlinkMode = false;
|
||||
_uri.clear();
|
||||
_customId.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DoConEmuAction(const std::wstring_view /*string*/) noexcept override
|
||||
void DoConEmuAction(const std::wstring_view /*string*/) noexcept override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::wstring _printString;
|
||||
@ -1544,11 +1494,6 @@ class StateMachineExternalTest final
|
||||
{
|
||||
TEST_CLASS(StateMachineExternalTest);
|
||||
|
||||
TEST_METHOD_SETUP(SetupState)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void InsertNumberToMachine(StateMachine* const pMachine, size_t number)
|
||||
{
|
||||
static const size_t cchBufferMax = 20;
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
return true;
|
||||
};
|
||||
|
||||
bool ActionPassThroughString(const std::wstring_view string, const bool /*flush*/) override
|
||||
bool ActionPassThroughString(const std::wstring_view string) override
|
||||
{
|
||||
passedThrough += string;
|
||||
return true;
|
||||
@ -69,10 +69,6 @@ public:
|
||||
|
||||
bool ActionVt52EscDispatch(const VTID /*id*/, const VTParameters /*parameters*/) override { return true; };
|
||||
|
||||
bool ActionClear() override { return true; };
|
||||
|
||||
bool ActionIgnore() override { return true; };
|
||||
|
||||
bool ActionOscDispatch(const size_t /* parameter */, const std::wstring_view /* string */) override
|
||||
{
|
||||
if (pfnFlushToTerminal)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user