Files
terminal/src/renderer/vt/XtermEngine.hpp
James Holderness 9c16c5ca82 Make sure DCS strings are flushed to conpty without delay (#17195)
When the `DCS` passthrough code was first implemented, it relied on the
`ActionPassThroughString` method flushing the given string immediately.
However, that has since stopped being the case, so `DCS` operations end
up being delayed until the entire sequence has been parsed.

This PR fixes the issue by introducing a `flush` parameter to force an
immediate flush on the `ActionPassThroughString` method, as well as the
`XtermEngine::WriteTerminalW` method that it calls.

## Validation Steps Performed

I've confirmed that the test case in issue #17111 now updates the color
table as soon as each color entry is parsed, instead of delaying the
updates until the end of the sequence.

Closes #17111
2024-05-06 20:03:33 +00:00

83 lines
3.0 KiB
C++

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- XtermEngine.hpp
Abstract:
- This is the definition of the VT specific implementation of the renderer.
This is the xterm implementation, which supports advanced sequences such as
inserting and deleting lines, but only 16 colors.
This engine supports both xterm and xterm-ascii VT modes.
The difference being that xterm-ascii will render any characters above 0x7f
as '?', in order to support older legacy tools.
Author(s):
- Mike Griese (migrie) 01-Sept-2017
--*/
#pragma once
#include "vtrenderer.hpp"
namespace Microsoft::Console::Render
{
class XtermEngine : public VtEngine
{
public:
XtermEngine(_In_ wil::unique_hfile hPipe,
const Microsoft::Console::Types::Viewport initialViewport,
const bool fUseAsciiOnly);
virtual ~XtermEngine() override = default;
[[nodiscard]] HRESULT StartPaint() noexcept override;
[[nodiscard]] HRESULT EndPaint() noexcept override;
[[nodiscard]] HRESULT PaintCursor(const CursorOptions& options) noexcept override;
[[nodiscard]] virtual HRESULT UpdateDrawingBrushes(const TextAttribute& textAttributes,
const RenderSettings& renderSettings,
const gsl::not_null<IRenderData*> pData,
const bool usingSoftFont,
const bool isSettingDefaultBrushes) noexcept override;
[[nodiscard]] HRESULT PaintBufferLine(const std::span<const Cluster> clusters,
const til::point coord,
const bool trimLeft,
const bool lineWrapped) noexcept override;
[[nodiscard]] HRESULT ScrollFrame() noexcept override;
[[nodiscard]] HRESULT InvalidateScroll(const til::point* const pcoordDelta) noexcept override;
[[nodiscard]] HRESULT WriteTerminalW(const std::wstring_view str, const bool flush) noexcept override;
[[nodiscard]] HRESULT SetWindowVisibility(const bool showOrHide) noexcept override;
protected:
// I'm using a non-class enum here, so that the values
// are trivially convertible and comparable to bool.
enum class Tribool : uint8_t
{
False = 0,
True,
Invalid,
};
const bool _fUseAsciiOnly;
bool _needToDisableCursor;
Tribool _lastCursorIsVisible;
bool _nextCursorIsVisible;
[[nodiscard]] HRESULT _MoveCursor(const til::point coord) noexcept override;
[[nodiscard]] HRESULT _DoUpdateTitle(const std::wstring_view newTitle) noexcept override;
#ifdef UNIT_TESTING
friend class VtRendererTest;
friend class ConptyOutputTests;
#endif
};
}