695ebffca1
## Summary of the Pull Request This PR adds full support for the `DECSCNM` reverse screen mode in the Windows Terminal to align with the implementation in conhost. ## References * The conhost implementation of `DECSCNM` was in PR #3817. * WT originally inherited that functionality via the colors being passed through, but that behaviour was lost in PR #6506. ## PR Checklist * [x] Closes #6622 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #6622 ## Detailed Description of the Pull Request / Additional comments The `AdaptDispatch::SetScreenMode` now checks if it's in conpty mode and simply returns false to force a pass-through of the mode change. And the `TerminalDispatch` now has its own `SetScreenMode` implementation that tracks any changes to the reversed state, and triggers a redraw in the renderer. To make the renderer work, we just needed to update the `GetForegroundColor` and `GetBackgroundColor` methods of the terminal's `IRenderData` implementation to check the reversed state, and switch the colors being calculated, the same way the `LookupForegroundColor` and `LookupBackgroundColor` methods work in the conhost `Settings` class. ## Validation Steps Performed I've manually tested the `DECSCNM` functionality for Windows Terminal in Vttest, and also with some of my own test scripts.
65 lines
3.1 KiB
C++
65 lines
3.1 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
#pragma once
|
|
|
|
#include "../../terminal/adapter/DispatchTypes.hpp"
|
|
#include "../../buffer/out/TextAttribute.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 TextAttribute GetTextAttributes() const noexcept = 0;
|
|
virtual void SetTextAttributes(const TextAttribute& attrs) 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 SetScreenMode(const bool reverseMode) 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;
|
|
|
|
virtual bool CopyToClipboard(std::wstring_view content) noexcept = 0;
|
|
|
|
protected:
|
|
ITerminalApi() = default;
|
|
};
|
|
}
|