Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/base/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ void Renderer::_PaintBufferOutput(_In_ IRenderEngine* const pEngine)
auto resetLineTransform = wil::scope_exit([&]() {
LOG_IF_FAILED(pEngine->ResetLineTransform());
});

for (const auto& dirtyRect : dirtyAreas)
{
if (!dirtyRect)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/vt/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ void VtEngine::Cork(bool corked) noexcept

// Method Description:
// - This method will modify the DPI we're using for scaling calculations.
// Does nothing for vt, the dpi is handed by the terminal.
// Arguments:
// Does nothing for vt, the dpi is handed by the terminal.
// - iDpi - The Dots Per Inch to use for scaling. We will use this relative to
// the system default DPI defined in Windows headers as a constant.
// Return Value:
Expand Down
6 changes: 6 additions & 0 deletions src/terminal/adapter/ITermDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch

virtual bool DoITerm2Action(const std::wstring_view string) = 0;

virtual bool DoWarpInBandGeneratorAction() = 0;

virtual bool DoWarpAction() = 0;

virtual bool DoWarpResetGridAction() = 0;

virtual bool DoFinalTermAction(const std::wstring_view string) = 0;

virtual bool DoVsCodeAction(const std::wstring_view string) = 0;
Expand Down
68 changes: 68 additions & 0 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3253,6 +3253,7 @@ bool AdaptDispatch::HardReset()

// Routine Description:
// - DECALN - Fills the entire screen with a test pattern of uppercase Es,
//
// resets the margins and rendition attributes, and moves the cursor to
// the home position.
// Arguments:
Expand Down Expand Up @@ -3756,6 +3757,73 @@ bool AdaptDispatch::DoConEmuAction(const std::wstring_view string)
return false;
}

// Method Description:
// - Performs a iTerm2 action
// - Ascribes to the ITermDispatch interface
// - Currently, the actions we support are:
// * `OSC1337;SetMark`: mark a line as a prompt line
// - Not actually used in conhost
// Arguments:
// - string: contains the parameters that define which action we do
// Return Value:
// - false in conhost, true for the SetMark action, otherwise false.
bool AdaptDispatch::DoWarpAction()
{
const auto isConPty = _api.IsConsolePty();
if (isConPty)
{
// Flush the frame manually, to make sure marks end up on the right
// line, like the alt buffer sequence.
_renderer.TriggerFlush(false);
//CursorPosition(1, 1);
}

return !isConPty;
}

// Method Description:
// - Performs a iTerm2 action
// - Ascribes to the ITermDispatch interface
// - Currently, the actions we support are:
// * `OSC1337;SetMark`: mark a line as a prompt line
// - Not actually used in conhost
// Arguments:
// - string: contains the parameters that define which action we do
// Return Value:
// - false in conhost, true for the SetMark action, otherwise false.
bool AdaptDispatch::DoWarpInBandGeneratorAction()
{
const auto isConPty = _api.IsConsolePty();
if (isConPty)
{
// Flush the frame manually, to make sure marks end up on the right
// line, like the alt buffer sequence.
_renderer.TriggerFlush(false);
}

return !isConPty;
}

bool AdaptDispatch::DoWarpResetGridAction()
{
const auto isConPty = _api.IsConsolePty();
if (isConPty)
{
// Flush the frame manually, to make sure marks end up on the right
// line, like the alt buffer sequence.
_renderer.TriggerFlush(false);

// Clear grid without painting.
// ATODO: Anything else we need to reset here?
CursorPosition(1, 1);
_pages.ActivePage().Buffer().Reset();
_renderer.TriggerFlush(false);
//_pages.ActivePage().Buffer().Reset();
}

return !isConPty;
}

// Method Description:
// - Performs a iTerm2 action
// - Ascribes to the ITermDispatch interface
Expand Down
6 changes: 6 additions & 0 deletions src/terminal/adapter/adaptDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ namespace Microsoft::Console::VirtualTerminal

bool DoITerm2Action(const std::wstring_view string) override;

bool DoWarpInBandGeneratorAction() override;

bool DoWarpAction() override;

bool DoWarpResetGridAction() override;

bool DoFinalTermAction(const std::wstring_view string) override;

bool DoVsCodeAction(const std::wstring_view string) override;
Expand Down
5 changes: 5 additions & 0 deletions src/terminal/adapter/termDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons

bool DoFinalTermAction(const std::wstring_view /*string*/) override { return false; }

bool DoWarpInBandGeneratorAction() override { return false; }
bool DoWarpAction() override { return false; }

bool DoWarpResetGridAction() override { return false; }

bool DoVsCodeAction(const std::wstring_view /*string*/) override { return false; }

StringHandler DownloadDRCS(const VTInt /*fontNumber*/,
Expand Down
27 changes: 27 additions & 0 deletions src/terminal/parser/OutputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ IStateMachineEngine::StringHandler OutputStateMachineEngine::ActionDcsDispatch(c
case DcsActionCodes::DECRQSS_RequestSetting:
handler = _dispatch->RequestSetting();
break;
case DcsActionCodes::DCS_WARP:
_dispatch->DoWarpAction();
handler = nullptr;
break;
case DcsActionCodes::DECRSPS_RestorePresentationState:
handler = _dispatch->RestorePresentationState(parameters.at(0));
break;
Expand All @@ -750,6 +754,13 @@ IStateMachineEngine::StringHandler OutputStateMachineEngine::ActionDcsDispatch(c
break;
}

// If we were unable to process the string, and there's a TTY attached to us,
// trigger the state machine to flush the string to the terminal.
if (_pfnFlushToTerminal != nullptr && handler == nullptr)
{
_pfnFlushToTerminal();
}

_ClearLastChar();

return handler;
Expand Down Expand Up @@ -903,6 +914,22 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
success = _dispatch->DoITerm2Action(string);
break;
}

case OscActionCodes::WarpInBandGeneratorAction:
{
success = _dispatch->DoWarpInBandGeneratorAction();
break;
}
case OscActionCodes::WarpAction:
{
success = _dispatch->DoWarpAction();
break;
}
case OscActionCodes::WarpResetGridAction:
{
success = _dispatch->DoWarpResetGridAction();
break;
}
case OscActionCodes::FinalTermAction:
{
success = _dispatch->DoFinalTermAction(string);
Expand Down
4 changes: 4 additions & 0 deletions src/terminal/parser/OutputStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ namespace Microsoft::Console::VirtualTerminal
DECRSTS_RestoreTerminalState = VTID("$p"),
DECRQSS_RequestSetting = VTID("$q"),
DECRSPS_RestorePresentationState = VTID("$t"),
DCS_WARP = VTID("d"),
};

enum Vt52ActionCodes : uint64_t
Expand Down Expand Up @@ -229,6 +230,9 @@ namespace Microsoft::Console::VirtualTerminal
FinalTermAction = 133,
VsCodeAction = 633,
ITerm2Action = 1337,
WarpInBandGeneratorAction = 9277,
WarpAction = 9278,
WarpResetGridAction = 9279,
Comment on lines +233 to +235
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the OSCs that we add support for in ConPTY

};

bool _GetOscSetColorTable(const std::wstring_view string,
Expand Down