94bcbb9204
The OutputStateMachine needs to collect "Intermediate" characters to be able to call [`Designate G0 Character Set`](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Controls-beginning-with-ESC) (as well as other sequences we don't yet support). However, the InputStateMachine used by conpty to process input should _not_ collect these characters. The input engine uses `\x1b` as an indicator that a key was pressed with `Alt`. For keys like `/`, we want to dispatch the key immediately, instead of collecting it and leaving us in the Escape state.
60 lines
2.5 KiB
C++
60 lines
2.5 KiB
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT license.
|
|
|
|
/*
|
|
Module Name:
|
|
- IStateMachineEngine.hpp
|
|
|
|
Abstract:
|
|
- This is the interface for a VT state machine language
|
|
The terminal handles input sequences and output sequences differently,
|
|
almost as two seperate grammars. This enables different grammars to leverage
|
|
the existing VT parsing.
|
|
*/
|
|
#pragma once
|
|
namespace Microsoft::Console::VirtualTerminal
|
|
{
|
|
class IStateMachineEngine
|
|
{
|
|
public:
|
|
virtual ~IStateMachineEngine() = 0;
|
|
|
|
virtual bool ActionExecute(const wchar_t wch) = 0;
|
|
virtual bool ActionExecuteFromEscape(const wchar_t wch) = 0;
|
|
virtual bool ActionPrint(const wchar_t wch) = 0;
|
|
virtual bool ActionPrintString(const wchar_t* const rgwch,
|
|
size_t const cch) = 0;
|
|
|
|
virtual bool ActionPassThroughString(const wchar_t* const rgwch,
|
|
size_t const cch) = 0;
|
|
|
|
virtual bool ActionEscDispatch(const wchar_t wch,
|
|
const unsigned short cIntermediate,
|
|
const wchar_t wchIntermediate) = 0;
|
|
virtual bool ActionCsiDispatch(const wchar_t wch,
|
|
const unsigned short cIntermediate,
|
|
const wchar_t wchIntermediate,
|
|
_In_reads_(cParams) const unsigned short* const rgusParams,
|
|
const unsigned short cParams) = 0;
|
|
|
|
virtual bool ActionClear() = 0;
|
|
|
|
virtual bool ActionIgnore() = 0;
|
|
|
|
virtual bool ActionOscDispatch(const wchar_t wch,
|
|
const unsigned short sOscParam,
|
|
_Inout_updates_(cchOscString) wchar_t* const pwchOscStringBuffer,
|
|
const unsigned short cchOscString) = 0;
|
|
|
|
virtual bool ActionSs3Dispatch(const wchar_t wch,
|
|
_In_reads_(cParams) const unsigned short* const rgusParams,
|
|
const unsigned short cParams) = 0;
|
|
|
|
virtual bool FlushAtEndOfString() const = 0;
|
|
virtual bool DispatchControlCharsFromEscape() const = 0;
|
|
virtual bool DispatchIntermediatesFromEscape() const = 0;
|
|
};
|
|
|
|
inline IStateMachineEngine::~IStateMachineEngine() {}
|
|
}
|