Skip to content

Commit

Permalink
Only send DA requests to Xterm256 clients.
Browse files Browse the repository at this point in the history
  • Loading branch information
j4james committed Mar 1, 2023
1 parent 76f4502 commit 484d331
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/renderer/vt/Xterm256Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ Xterm256Engine::Xterm256Engine(_In_ wil::unique_hfile hPipe,
{
}

// Method Description:
// - Sends a sequence to request the device attributes of the connected client.
// Flushes the buffer as well, to make sure the request is sent to the terminal.
// Arguments:
// - <none>
// Return Value:
// - S_OK if we succeeded, else an appropriate HRESULT.
HRESULT Xterm256Engine::RequestDeviceAttributes() noexcept
{
RETURN_IF_FAILED(_Write("\033[c"));
RETURN_IF_FAILED(_Flush());
return S_OK;
}

// Routine Description:
// - Write a VT sequence to change the current colors of text. Writes true RGB
// color sequences.
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/vt/Xterm256Engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ namespace Microsoft::Console::Render

virtual ~Xterm256Engine() override = default;

[[nodiscard]] HRESULT RequestDeviceAttributes() noexcept override;

[[nodiscard]] HRESULT UpdateDrawingBrushes(const TextAttribute& textAttributes,
const RenderSettings& renderSettings,
const gsl::not_null<IRenderData*> pData,
Expand Down
8 changes: 3 additions & 5 deletions src/renderer/vt/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,14 @@ void VtEngine::SetTerminalOwner(Microsoft::Console::VirtualTerminal::VtIo* const

// Method Description:
// - Sends a sequence to request the device attributes of the connected client.
// Flushes the buffer as well, to make sure the request is sent to the terminal.
// This is not implemented by default. Only supported in the Xterm256 engine.
// Arguments:
// - <none>
// Return Value:
// - S_OK if we succeeded, else an appropriate HRESULT.
// - S_OK if we succeeded, E_NOTIMPL if not implemented.
HRESULT VtEngine::RequestDeviceAttributes() noexcept
{
RETURN_IF_FAILED(_Write("\033[c"));
RETURN_IF_FAILED(_Flush());
return S_OK;
return E_NOTIMPL;
}

// Method Description:
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/vt/vtrenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace Microsoft::Console::Render

// VtEngine
[[nodiscard]] HRESULT SuppressResizeRepaint() noexcept;
[[nodiscard]] HRESULT RequestDeviceAttributes() noexcept;
[[nodiscard]] virtual HRESULT RequestDeviceAttributes() noexcept;
[[nodiscard]] HRESULT RequestCursor() noexcept;
[[nodiscard]] HRESULT InheritCursor(const til::point coordCursor) noexcept;
[[nodiscard]] HRESULT WriteTerminalUtf8(const std::string_view str) noexcept;
Expand Down

0 comments on commit 484d331

Please sign in to comment.