f32761849f
Adds support for `win32-input-mode` to conhost, conpty, and the Windows Terminal. * The shared `terminalInput` class supports sending these sequences when a VT client application requests this mode. * ConPTY supports synthesizing `INPUT_RECORD`s from the input sent to it from a terminal * ConPTY requests this mode immediately on startup (if started with a new flag, `PSEUDOCONSOLE_WIN32_INPUT_MODE`) * The Terminal now supports sending this input as well, when conpty asks for it. Also adds a new ConPTY flag `PSEUDOCONSOLE_WIN32_INPUT_MODE` which requests this functionality from conpty, and the Terminal requests this by default. Also adds `experimental.input.forceVT` as a global setting to let a user opt-out of this behavior, if they don't want it / this ends up breaking horribly. ## Validation Steps Performed * played with this mode in vtpipeterm * played with this mode in Terminal * checked a bunch of scenarios, as outlined in a [comment] on #4999 [comment]: https://github.com/microsoft/terminal/issues/4999#issuecomment-628718631 References #4999: The megathread References #5887: The spec Closes #879 Closes #2865 Closes #530 Closes #3079 Closes #1119 Closes #1694 Closes #3608 Closes #4334 Closes #4446
68 lines
3.4 KiB
C++
68 lines
3.4 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
#pragma once
|
|
|
|
#include "../../terminal/adapter/DispatchTypes.hpp"
|
|
|
|
namespace Microsoft::Terminal::Core
|
|
{
|
|
class ITerminalApi
|
|
{
|
|
public:
|
|
virtual ~ITerminalApi() {}
|
|
ITerminalApi(const ITerminalApi&) = default;
|
|
ITerminalApi(ITerminalApi&&) = default;
|
|
ITerminalApi& operator=(const ITerminalApi&) = default;
|
|
ITerminalApi& operator=(ITerminalApi&&) = default;
|
|
|
|
virtual bool PrintString(std::wstring_view string) noexcept = 0;
|
|
virtual bool ExecuteChar(wchar_t wch) noexcept = 0;
|
|
|
|
virtual bool SetTextToDefaults(bool foreground, bool background) noexcept = 0;
|
|
virtual bool SetTextForegroundIndex(BYTE colorIndex) noexcept = 0;
|
|
virtual bool SetTextBackgroundIndex(BYTE colorIndex) noexcept = 0;
|
|
virtual bool SetTextForegroundIndex256(BYTE colorIndex) noexcept = 0;
|
|
virtual bool SetTextBackgroundIndex256(BYTE colorIndex) noexcept = 0;
|
|
virtual bool SetTextRgbColor(COLORREF color, bool foreground) noexcept = 0;
|
|
virtual bool BoldText(bool boldOn) noexcept = 0;
|
|
virtual bool UnderlineText(bool underlineOn) noexcept = 0;
|
|
virtual bool ReverseText(bool reversed) noexcept = 0;
|
|
|
|
virtual bool SetCursorPosition(short x, short y) noexcept = 0;
|
|
virtual COORD GetCursorPosition() noexcept = 0;
|
|
virtual bool SetCursorVisibility(const bool visible) noexcept = 0;
|
|
virtual bool CursorLineFeed(const bool withReturn) noexcept = 0;
|
|
virtual bool EnableCursorBlinking(const bool enable) noexcept = 0;
|
|
|
|
virtual bool DeleteCharacter(const size_t count) noexcept = 0;
|
|
virtual bool InsertCharacter(const size_t count) noexcept = 0;
|
|
virtual bool EraseCharacters(const size_t numChars) noexcept = 0;
|
|
virtual bool EraseInLine(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::EraseType eraseType) noexcept = 0;
|
|
virtual bool EraseInDisplay(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::EraseType eraseType) noexcept = 0;
|
|
|
|
virtual bool SetWindowTitle(std::wstring_view title) noexcept = 0;
|
|
|
|
virtual bool SetColorTableEntry(const size_t tableIndex, const DWORD color) noexcept = 0;
|
|
|
|
virtual bool SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle) noexcept = 0;
|
|
|
|
virtual bool SetDefaultForeground(const DWORD color) noexcept = 0;
|
|
virtual bool SetDefaultBackground(const DWORD color) noexcept = 0;
|
|
|
|
virtual bool EnableWin32InputMode(const bool win32InputMode) noexcept = 0;
|
|
virtual bool SetCursorKeysMode(const bool applicationMode) noexcept = 0;
|
|
virtual bool SetKeypadMode(const bool applicationMode) noexcept = 0;
|
|
virtual bool EnableVT200MouseMode(const bool enabled) noexcept = 0;
|
|
virtual bool EnableUTF8ExtendedMouseMode(const bool enabled) noexcept = 0;
|
|
virtual bool EnableSGRExtendedMouseMode(const bool enabled) noexcept = 0;
|
|
virtual bool EnableButtonEventMouseMode(const bool enabled) noexcept = 0;
|
|
virtual bool EnableAnyEventMouseMode(const bool enabled) noexcept = 0;
|
|
virtual bool EnableAlternateScrollMode(const bool enabled) noexcept = 0;
|
|
|
|
virtual bool IsVtInputEnabled() const = 0;
|
|
|
|
protected:
|
|
ITerminalApi() = default;
|
|
};
|
|
}
|