Remove the WinTelnetEngine (#6526)
Nobody was using it. Discussed in #2661.
This commit is contained in:
parent
c1076a823d
commit
ffaba38fd4
|
@ -18,7 +18,6 @@
|
|||
#include "../../renderer/base/Renderer.hpp"
|
||||
#include "../../renderer/vt/Xterm256Engine.hpp"
|
||||
#include "../../renderer/vt/XtermEngine.hpp"
|
||||
#include "../../renderer/vt/WinTelnetEngine.hpp"
|
||||
|
||||
class InputBuffer; // This for some reason needs to be fwd-decl'd
|
||||
#include "../host/inputBuffer.hpp"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "../renderer/vt/XtermEngine.hpp"
|
||||
#include "../renderer/vt/Xterm256Engine.hpp"
|
||||
#include "../renderer/vt/WinTelnetEngine.hpp"
|
||||
|
||||
#include "../renderer/base/renderer.hpp"
|
||||
#include "../types/inc/utils.hpp"
|
||||
|
@ -51,10 +50,6 @@ VtIo::VtIo() :
|
|||
{
|
||||
ioMode = VtIoMode::XTERM;
|
||||
}
|
||||
else if (VtMode == WIN_TELNET_STRING)
|
||||
{
|
||||
ioMode = VtIoMode::WIN_TELNET;
|
||||
}
|
||||
else if (VtMode == XTERM_ASCII_STRING)
|
||||
{
|
||||
ioMode = VtIoMode::XTERM_ASCII;
|
||||
|
@ -178,12 +173,6 @@ VtIo::VtIo() :
|
|||
gci.Get16ColorTable(),
|
||||
true);
|
||||
break;
|
||||
case VtIoMode::WIN_TELNET:
|
||||
_pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(_hOutput),
|
||||
gci,
|
||||
initialViewport,
|
||||
gci.Get16ColorTable());
|
||||
break;
|
||||
default:
|
||||
return E_FAIL;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "../../renderer/base/Renderer.hpp"
|
||||
#include "../../renderer/vt/Xterm256Engine.hpp"
|
||||
#include "../../renderer/vt/XtermEngine.hpp"
|
||||
#include "../../renderer/vt/WinTelnetEngine.hpp"
|
||||
#include "../Settings.hpp"
|
||||
|
||||
#include "CommonState.hpp"
|
||||
|
|
|
@ -663,7 +663,7 @@ void ConsoleArgumentsTests::CombineVtPipeHandleTests()
|
|||
false), // inheritCursor
|
||||
true); // successful parse?
|
||||
|
||||
commandline = L"conhost.exe --vtmode telnet";
|
||||
commandline = L"conhost.exe --vtmode xterm-256color";
|
||||
ArgTestsRunner(L"#2 Check that handles with mode is OK",
|
||||
commandline,
|
||||
hInSample,
|
||||
|
@ -672,7 +672,7 @@ void ConsoleArgumentsTests::CombineVtPipeHandleTests()
|
|||
L"", // clientCommandLine
|
||||
hInSample,
|
||||
hOutSample,
|
||||
L"telnet", // vtMode
|
||||
L"xterm-256color", // vtMode
|
||||
0, // width
|
||||
0, // height
|
||||
false, // forceV1
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "..\..\renderer\vt\Xterm256Engine.hpp"
|
||||
#include "..\..\renderer\vt\XtermEngine.hpp"
|
||||
#include "..\..\renderer\vt\WinTelnetEngine.hpp"
|
||||
#include "..\..\renderer\base\Renderer.hpp"
|
||||
#include "..\Settings.hpp"
|
||||
#include "..\VtIo.hpp"
|
||||
|
@ -83,9 +82,6 @@ void VtIoTests::ModeParsingTest()
|
|||
VERIFY_SUCCEEDED(VtIo::ParseIoMode(L"xterm-256color", mode));
|
||||
VERIFY_ARE_EQUAL(mode, VtIoMode::XTERM_256);
|
||||
|
||||
VERIFY_SUCCEEDED(VtIo::ParseIoMode(L"win-telnet", mode));
|
||||
VERIFY_ARE_EQUAL(mode, VtIoMode::WIN_TELNET);
|
||||
|
||||
VERIFY_SUCCEEDED(VtIo::ParseIoMode(L"xterm-ascii", mode));
|
||||
VERIFY_ARE_EQUAL(mode, VtIoMode::XTERM_ASCII);
|
||||
|
||||
|
@ -145,13 +141,6 @@ void VtIoTests::DtorTestJustEngine()
|
|||
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
|
||||
delete pRenderEngineXtermAscii;
|
||||
Log::Comment(NoThrowString().Format(L"Deleted."));
|
||||
|
||||
hOutputFile.reset(INVALID_HANDLE_VALUE);
|
||||
|
||||
auto pRenderEngineWinTelnet = new WinTelnetEngine(std::move(hOutputFile), p, SetUpViewport(), colorTable);
|
||||
Log::Comment(NoThrowString().Format(L"Made WinTelnetEngine"));
|
||||
delete pRenderEngineWinTelnet;
|
||||
Log::Comment(NoThrowString().Format(L"Deleted."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,17 +200,6 @@ void VtIoTests::DtorTestDeleteVtio()
|
|||
Log::Comment(NoThrowString().Format(L"Made XtermEngine"));
|
||||
delete vtio;
|
||||
Log::Comment(NoThrowString().Format(L"Deleted."));
|
||||
|
||||
hOutputFile = wil::unique_hfile(INVALID_HANDLE_VALUE);
|
||||
vtio = new VtIo();
|
||||
Log::Comment(NoThrowString().Format(L"Made VtIo"));
|
||||
vtio->_pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
|
||||
p,
|
||||
SetUpViewport(),
|
||||
colorTable);
|
||||
Log::Comment(NoThrowString().Format(L"Made WinTelnetEngine"));
|
||||
delete vtio;
|
||||
Log::Comment(NoThrowString().Format(L"Deleted."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,15 +252,6 @@ void VtIoTests::DtorTestStackAlloc()
|
|||
colorTable,
|
||||
true);
|
||||
}
|
||||
|
||||
hOutputFile.reset(INVALID_HANDLE_VALUE);
|
||||
{
|
||||
VtIo vtio;
|
||||
vtio._pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
|
||||
p,
|
||||
SetUpViewport(),
|
||||
colorTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,13 +298,6 @@ void VtIoTests::DtorTestStackAllocMany()
|
|||
SetUpViewport(),
|
||||
colorTable,
|
||||
true);
|
||||
|
||||
hOutputFile.reset(INVALID_HANDLE_VALUE);
|
||||
VtIo vtio4;
|
||||
vtio4._pVtRenderEngine = std::make_unique<WinTelnetEngine>(std::move(hOutputFile),
|
||||
p,
|
||||
SetUpViewport(),
|
||||
colorTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "../../renderer/vt/Xterm256Engine.hpp"
|
||||
#include "../../renderer/vt/XtermEngine.hpp"
|
||||
#include "../../renderer/vt/WinTelnetEngine.hpp"
|
||||
#include "../Settings.hpp"
|
||||
|
||||
using namespace WEX::Common;
|
||||
|
@ -109,10 +108,6 @@ class Microsoft::Console::Render::VtRendererTest
|
|||
TEST_METHOD(XtermTestColors);
|
||||
TEST_METHOD(XtermTestCursor);
|
||||
|
||||
TEST_METHOD(WinTelnetTestInvalidate);
|
||||
TEST_METHOD(WinTelnetTestColors);
|
||||
TEST_METHOD(WinTelnetTestCursor);
|
||||
|
||||
TEST_METHOD(FormattedString);
|
||||
|
||||
TEST_METHOD(TestWrapping);
|
||||
|
@ -1146,236 +1141,6 @@ void VtRendererTest::XtermTestCursor()
|
|||
});
|
||||
}
|
||||
|
||||
void VtRendererTest::WinTelnetTestInvalidate()
|
||||
{
|
||||
wil::unique_hfile hFile = wil::unique_hfile(INVALID_HANDLE_VALUE);
|
||||
std::unique_ptr<WinTelnetEngine> engine = std::make_unique<WinTelnetEngine>(std::move(hFile), p, SetUpViewport(), g_ColorTable);
|
||||
auto pfn = std::bind(&VtRendererTest::WriteCallback, this, std::placeholders::_1, std::placeholders::_2);
|
||||
engine->SetTestCallback(pfn);
|
||||
|
||||
Viewport view = SetUpViewport();
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Make sure that invalidating all invalidates the whole viewport."));
|
||||
VERIFY_SUCCEEDED(engine->InvalidateAll());
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
});
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Make sure that invalidating anything only invalidates that portion"));
|
||||
SMALL_RECT invalid = { 1, 1, 2, 2 };
|
||||
VERIFY_SUCCEEDED(engine->Invalidate(&invalid));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_ARE_EQUAL(til::rectangle{ Viewport::FromExclusive(invalid).ToInclusive() }, *(engine->_invalidMap.begin()));
|
||||
});
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Make sure that scrolling invalidates the whole viewport, and sends no VT sequences"));
|
||||
COORD scrollDelta = { 0, 1 };
|
||||
VERIFY_SUCCEEDED(engine->InvalidateScroll(&scrollDelta));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL); // sentinel
|
||||
VERIFY_SUCCEEDED(engine->ScrollFrame());
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
|
||||
scrollDelta = { 0, -1 };
|
||||
VERIFY_SUCCEEDED(engine->InvalidateScroll(&scrollDelta));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->ScrollFrame());
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
|
||||
scrollDelta = { 1, 0 };
|
||||
VERIFY_SUCCEEDED(engine->InvalidateScroll(&scrollDelta));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->ScrollFrame());
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
|
||||
scrollDelta = { -1, 0 };
|
||||
VERIFY_SUCCEEDED(engine->InvalidateScroll(&scrollDelta));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->ScrollFrame());
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
|
||||
scrollDelta = { 1, -1 };
|
||||
VERIFY_SUCCEEDED(engine->InvalidateScroll(&scrollDelta));
|
||||
TestPaint(*engine, [&]() {
|
||||
VERIFY_IS_TRUE(engine->_invalidMap.all());
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->ScrollFrame());
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
}
|
||||
|
||||
void VtRendererTest::WinTelnetTestColors()
|
||||
{
|
||||
wil::unique_hfile hFile = wil::unique_hfile(INVALID_HANDLE_VALUE);
|
||||
std::unique_ptr<WinTelnetEngine> engine = std::make_unique<WinTelnetEngine>(std::move(hFile), p, SetUpViewport(), g_ColorTable);
|
||||
auto pfn = std::bind(&VtRendererTest::WriteCallback, this, std::placeholders::_1, std::placeholders::_2);
|
||||
engine->SetTestCallback(pfn);
|
||||
|
||||
Viewport view = SetUpViewport();
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Test changing the text attributes"));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Begin by setting the default colors - FG,BG = BRIGHT_WHITE,DARK_BLACK"));
|
||||
|
||||
qExpectedInput.push_back("\x1b[m");
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[15],
|
||||
g_ColorTable[0],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
|
||||
TestPaint(*engine, [&]() {
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Change only the BG----"));
|
||||
qExpectedInput.push_back("\x1b[41m"); // Background DARK_RED
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[15],
|
||||
g_ColorTable[4],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Change only the FG----"));
|
||||
qExpectedInput.push_back("\x1b[37m"); // Foreground DARK_WHITE
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[7],
|
||||
g_ColorTable[4],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Change only the BG to something not in the table----"));
|
||||
qExpectedInput.push_back("\x1b[40m"); // Background DARK_BLACK
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[7], 0x010101, 0, ExtendedAttributes::Normal, false));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Change only the BG to the 'Default' background----"));
|
||||
qExpectedInput.push_back("\x1b[40m"); // Background DARK_BLACK
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[7],
|
||||
g_ColorTable[0],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Back to defaults----"));
|
||||
qExpectedInput.push_back("\x1b[m");
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[15],
|
||||
g_ColorTable[0],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
});
|
||||
|
||||
TestPaint(*engine, [&]() {
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Make sure that color setting persists across EndPaint/StartPaint"));
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->UpdateDrawingBrushes(g_ColorTable[15],
|
||||
g_ColorTable[0],
|
||||
0,
|
||||
ExtendedAttributes::Normal,
|
||||
false));
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1); // This will make sure nothing was written to the callback
|
||||
});
|
||||
}
|
||||
|
||||
void VtRendererTest::WinTelnetTestCursor()
|
||||
{
|
||||
wil::unique_hfile hFile = wil::unique_hfile(INVALID_HANDLE_VALUE);
|
||||
std::unique_ptr<WinTelnetEngine> engine = std::make_unique<WinTelnetEngine>(std::move(hFile), p, SetUpViewport(), g_ColorTable);
|
||||
auto pfn = std::bind(&VtRendererTest::WriteCallback, this, std::placeholders::_1, std::placeholders::_2);
|
||||
engine->SetTestCallback(pfn);
|
||||
|
||||
Viewport view = SetUpViewport();
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Test moving the cursor around. Every sequence should have both params to CUP explicitly."));
|
||||
TestPaint(*engine, [&]() {
|
||||
qExpectedInput.push_back("\x1b[2;2H");
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 1, 1 }));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Only move X coord----"));
|
||||
qExpectedInput.push_back("\x1b[31;2H");
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 1, 30 }));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Only move Y coord----"));
|
||||
qExpectedInput.push_back("\x1b[31;31H");
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 30, 30 }));
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"----Sending the same move sends nothing----"));
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 30, 30 }));
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1);
|
||||
|
||||
// The "real" location is the last place the cursor was moved to not
|
||||
// during the course of VT operations - eg the last place text was written,
|
||||
// or the cursor was manually painted at (MSFT 13310327)
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Make sure the cursor gets moved back to the last real location it was at"));
|
||||
qExpectedInput.push_back("\x1b[1;1H");
|
||||
// EndPaint will send this sequence for us.
|
||||
});
|
||||
|
||||
TestPaint(*engine, [&]() {
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Sending the same move across paint calls sends nothing."
|
||||
L"The cursor's last \"real\" position was 0,0"));
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 0, 0 }));
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1);
|
||||
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Paint some text at 0,0, then try moving the cursor to where it currently is."));
|
||||
qExpectedInput.push_back("\x1b[2;2H");
|
||||
qExpectedInput.push_back("asdfghjkl");
|
||||
|
||||
const wchar_t* const line = L"asdfghjkl";
|
||||
const unsigned char rgWidths[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
|
||||
std::vector<Cluster> clusters;
|
||||
for (size_t i = 0; i < wcslen(line); i++)
|
||||
{
|
||||
clusters.emplace_back(std::wstring_view{ &line[i], 1 }, static_cast<size_t>(rgWidths[i]));
|
||||
}
|
||||
|
||||
VERIFY_SUCCEEDED(engine->PaintBufferLine({ clusters.data(), clusters.size() }, { 1, 1 }, false, false));
|
||||
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 10, 1 }));
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1);
|
||||
});
|
||||
|
||||
// Note that only PaintBufferLine updates the "Real" cursor position, which
|
||||
// the cursor is moved back to at the end of each paint
|
||||
TestPaint(*engine, [&]() {
|
||||
Log::Comment(NoThrowString().Format(
|
||||
L"Sending the same move across paint calls sends nothing."));
|
||||
qExpectedInput.push_back(EMPTY_CALLBACK_SENTINEL);
|
||||
VERIFY_SUCCEEDED(engine->_MoveCursor({ 10, 1 }));
|
||||
WriteCallback(EMPTY_CALLBACK_SENTINEL, 1);
|
||||
});
|
||||
}
|
||||
|
||||
void VtRendererTest::TestWrapping()
|
||||
{
|
||||
wil::unique_hfile hFile = wil::unique_hfile(INVALID_HANDLE_VALUE);
|
||||
|
|
|
@ -8,12 +8,10 @@ enum class VtIoMode
|
|||
INVALID,
|
||||
XTERM,
|
||||
XTERM_256,
|
||||
WIN_TELNET,
|
||||
XTERM_ASCII
|
||||
};
|
||||
|
||||
const wchar_t* const XTERM_STRING = L"xterm";
|
||||
const wchar_t* const XTERM_256_STRING = L"xterm-256color";
|
||||
const wchar_t* const WIN_TELNET_STRING = L"win-telnet";
|
||||
const wchar_t* const XTERM_ASCII_STRING = L"xterm-ascii";
|
||||
const wchar_t* const DEFAULT_STRING = L"";
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "precomp.h"
|
||||
#include "WinTelnetEngine.hpp"
|
||||
#include "..\..\inc\conattrs.hpp"
|
||||
#pragma hdrstop
|
||||
using namespace Microsoft::Console;
|
||||
using namespace Microsoft::Console::Render;
|
||||
using namespace Microsoft::Console::Types;
|
||||
|
||||
WinTelnetEngine::WinTelnetEngine(_In_ wil::unique_hfile hPipe,
|
||||
const IDefaultColorProvider& colorProvider,
|
||||
const Viewport initialViewport,
|
||||
const std::basic_string_view<COLORREF> colorTable) :
|
||||
VtEngine(std::move(hPipe), colorProvider, initialViewport),
|
||||
_colorTable(colorTable)
|
||||
{
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Write a VT sequence to change the current colors of text. Only writes
|
||||
// 16-color attributes.
|
||||
// Arguments:
|
||||
// - colorForeground: The RGB Color to use to paint the foreground text.
|
||||
// - colorBackground: The RGB Color to use to paint the background of the text.
|
||||
// - legacyColorAttribute: A console attributes bit field specifying the brush
|
||||
// colors we should use.
|
||||
// - extendedAttrs - extended text attributes (italic, underline, etc.) to use.
|
||||
// - isSettingDefaultBrushes: indicates if we should change the background color of
|
||||
// the window. Unused for VT
|
||||
// Return Value:
|
||||
// - S_OK if we succeeded, else an appropriate HRESULT for failing to allocate or write.
|
||||
[[nodiscard]] HRESULT WinTelnetEngine::UpdateDrawingBrushes(const COLORREF colorForeground,
|
||||
const COLORREF colorBackground,
|
||||
const WORD /*legacyColorAttribute*/,
|
||||
const ExtendedAttributes extendedAttrs,
|
||||
const bool /*isSettingDefaultBrushes*/) noexcept
|
||||
{
|
||||
return VtEngine::_16ColorUpdateDrawingBrushes(colorForeground,
|
||||
colorBackground,
|
||||
WI_IsFlagSet(extendedAttrs, ExtendedAttributes::Bold),
|
||||
_colorTable);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Write a VT sequence to move the cursor to the specified coordinates. We
|
||||
// also store the last place we left the cursor for future optimizations.
|
||||
// Arguments:
|
||||
// - coord: location to move the cursor to.
|
||||
// Return Value:
|
||||
// - S_OK if we succeeded, else an appropriate HRESULT for failing to allocate or write.
|
||||
[[nodiscard]] HRESULT WinTelnetEngine::_MoveCursor(COORD const coord) noexcept
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
// don't try and be clever about moving the cursor.
|
||||
// Always just use the full sequence
|
||||
if (coord.X != _lastText.X || coord.Y != _lastText.Y)
|
||||
{
|
||||
hr = _CursorPosition(coord);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
_lastText = coord;
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Scrolls the existing data on the in-memory frame by the scroll region
|
||||
// deltas we have collectively received through the Invalidate methods
|
||||
// since the last time this was called.
|
||||
// Because win-telnet doesn't know how to do anything smart in response to
|
||||
// scrolling, we do nothing.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - S_OK
|
||||
[[nodiscard]] HRESULT WinTelnetEngine::ScrollFrame() noexcept
|
||||
{
|
||||
// win-telnet doesn't know anything about scroll vt sequences
|
||||
// every frame, we're repainting everything, always.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Notifies us that the console is attempting to scroll the existing screen
|
||||
// area
|
||||
// Arguments:
|
||||
// - pcoordDelta - Pointer to character dimension (COORD) of the distance the
|
||||
// console would like us to move while scrolling.
|
||||
// Return Value:
|
||||
// - S_OK if we succeeded, else an appropriate HRESULT for failing to allocate or write.
|
||||
[[nodiscard]] HRESULT WinTelnetEngine::InvalidateScroll(const COORD* const /*pcoordDelta*/) noexcept
|
||||
{
|
||||
// win-telnet assumes the client doesn't know anything about inserting or
|
||||
// deleting lines.
|
||||
// So instead, just invalidate the entire viewport. Every line is going to
|
||||
// have to move.
|
||||
return InvalidateAll();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Wrapper for ITerminalOutputConnection. Write an ascii-only string to the pipe.
|
||||
// Arguments:
|
||||
// - wstr - wstring of text to be written
|
||||
// Return Value:
|
||||
// - S_OK or suitable HRESULT error from either conversion or writing pipe.
|
||||
[[nodiscard]] HRESULT WinTelnetEngine::WriteTerminalW(_In_ const std::wstring_view wstr) noexcept
|
||||
{
|
||||
RETURN_IF_FAILED(VtEngine::_WriteTerminalAscii(wstr));
|
||||
// GH#4106, GH#2011 - WriteTerminalW is only ever called by the
|
||||
// StateMachine, when we've encountered a string we don't understand. When
|
||||
// this happens, we usually don't actually trigger another frame, but we
|
||||
// _do_ want this string to immediately be sent to the terminal. Since we
|
||||
// only flush our buffer on actual frames, this means that strings we've
|
||||
// decided to pass through would have gotten buffered here until the next
|
||||
// actual frame is triggered.
|
||||
//
|
||||
// To fix this, flush here, so this string is sent to the connected terminal
|
||||
// application.
|
||||
|
||||
return _Flush();
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*++
|
||||
Copyright (c) Microsoft Corporation
|
||||
Licensed under the MIT license.
|
||||
|
||||
Module Name:
|
||||
- WinTelnetEngine.hpp
|
||||
|
||||
Abstract:
|
||||
- This is the definition of the VT specific implementation of the renderer.
|
||||
This is the win-telnet implementation, which does NOT support advanced
|
||||
sequences such as inserting and deleting lines, and only supports 16 colors.
|
||||
|
||||
Author(s):
|
||||
- Mike Griese (migrie) 01-Sept-2017
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vtrenderer.hpp"
|
||||
|
||||
namespace Microsoft::Console::Render
|
||||
{
|
||||
class WinTelnetEngine : public VtEngine
|
||||
{
|
||||
public:
|
||||
WinTelnetEngine(_In_ wil::unique_hfile hPipe,
|
||||
const Microsoft::Console::IDefaultColorProvider& colorProvider,
|
||||
const Microsoft::Console::Types::Viewport initialViewport,
|
||||
const std::basic_string_view<COLORREF> colorTable);
|
||||
virtual ~WinTelnetEngine() override = default;
|
||||
|
||||
[[nodiscard]] HRESULT UpdateDrawingBrushes(const COLORREF colorForeground,
|
||||
const COLORREF colorBackground,
|
||||
const WORD legacyColorAttribute,
|
||||
const ExtendedAttributes extendedAttrs,
|
||||
const bool isSettingDefaultBrushes) noexcept override;
|
||||
[[nodiscard]] HRESULT ScrollFrame() noexcept override;
|
||||
|
||||
[[nodiscard]] HRESULT InvalidateScroll(const COORD* const pcoordDelta) noexcept override;
|
||||
|
||||
[[nodiscard]] HRESULT WriteTerminalW(const std::wstring_view wstr) noexcept override;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] HRESULT _MoveCursor(const COORD coord) noexcept;
|
||||
|
||||
private:
|
||||
const std::basic_string_view<COLORREF> _colorTable;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
friend class VtRendererTest;
|
||||
#endif
|
||||
};
|
||||
}
|
|
@ -27,7 +27,6 @@ SOURCES = \
|
|||
..\paint.cpp \
|
||||
..\state.cpp \
|
||||
..\tracing.cpp \
|
||||
..\WinTelnetEngine.cpp \
|
||||
..\XtermEngine.cpp \
|
||||
..\Xterm256Engine.cpp \
|
||||
..\VtSequences.cpp \
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<ClCompile Include="..\state.cpp" />
|
||||
<ClCompile Include="..\tracing.cpp" />
|
||||
<ClCompile Include="..\VtSequences.cpp" />
|
||||
<ClCompile Include="..\WinTelnetEngine.cpp" />
|
||||
<ClCompile Include="..\XtermEngine.cpp" />
|
||||
<ClCompile Include="..\Xterm256Engine.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -24,7 +23,6 @@
|
|||
<ClInclude Include="..\precomp.h" />
|
||||
<ClInclude Include="..\tracing.hpp" />
|
||||
<ClInclude Include="..\vtrenderer.hpp" />
|
||||
<ClInclude Include="..\WinTelnetEngine.hpp" />
|
||||
<ClInclude Include="..\XtermEngine.hpp" />
|
||||
<ClInclude Include="..\Xterm256Engine.hpp" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue