Skip to content

Commit 87b3e94

Browse files
vorporealacarl005
authored andcommitted
Port conpty changes to latest codebase. (#3)
1 parent b4e69c6 commit 87b3e94

5 files changed

Lines changed: 96 additions & 0 deletions

File tree

src/terminal/adapter/ITermDispatch.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch
154154

155155
virtual void DoITerm2Action(const std::wstring_view string) = 0;
156156

157+
virtual void DoWarpInBandGeneratorAction() = 0;
158+
159+
virtual void DoWarpAction() = 0;
160+
161+
virtual void DoWarpResetGridAction() = 0;
162+
157163
virtual void DoFinalTermAction(const std::wstring_view string) = 0;
158164

159165
virtual void DoVsCodeAction(const std::wstring_view string) = 0;

src/terminal/adapter/adaptDispatch.cpp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,6 +3644,67 @@ void AdaptDispatch::DoITerm2Action(const std::wstring_view string)
36443644
}
36453645
}
36463646

3647+
// Method Description:
3648+
// - Performs a iTerm2 action
3649+
// - Ascribes to the ITermDispatch interface
3650+
// - Currently, the actions we support are:
3651+
// * `OSC1337;SetMark`: mark a line as a prompt line
3652+
// - Not actually used in conhost
3653+
// Arguments:
3654+
// - string: contains the parameters that define which action we do
3655+
// Return Value:
3656+
// - false in conhost, true for the SetMark action, otherwise false.
3657+
void AdaptDispatch::DoWarpAction()
3658+
{
3659+
// const auto isConPty = _api.IsConsolePty();
3660+
// if (isConPty)
3661+
// {
3662+
// // Flush the frame manually, to make sure marks end up on the right
3663+
// // line, like the alt buffer sequence.
3664+
// _renderer.TriggerFlush(false);
3665+
// //CursorPosition(1, 1);
3666+
// }
3667+
}
3668+
3669+
// Method Description:
3670+
// - Performs a iTerm2 action
3671+
// - Ascribes to the ITermDispatch interface
3672+
// - Currently, the actions we support are:
3673+
// * `OSC1337;SetMark`: mark a line as a prompt line
3674+
// - Not actually used in conhost
3675+
// Arguments:
3676+
// - string: contains the parameters that define which action we do
3677+
// Return Value:
3678+
// - false in conhost, true for the SetMark action, otherwise false.
3679+
void AdaptDispatch::DoWarpInBandGeneratorAction()
3680+
{
3681+
// const auto isConPty = _api.IsConsolePty();
3682+
// if (isConPty)
3683+
// {
3684+
// // Flush the frame manually, to make sure marks end up on the right
3685+
// // line, like the alt buffer sequence.
3686+
// _renderer.TriggerFlush(false);
3687+
// }
3688+
}
3689+
3690+
void AdaptDispatch::DoWarpResetGridAction()
3691+
{
3692+
// const auto isConPty = _api.IsConsolePty();
3693+
// if (isConPty)
3694+
// {
3695+
// // Flush the frame manually, to make sure marks end up on the right
3696+
// // line, like the alt buffer sequence.
3697+
// _renderer.TriggerFlush(false);
3698+
3699+
// Clear grid without painting.
3700+
// ATODO: Anything else we need to reset here?
3701+
CursorPosition(1, 1);
3702+
_pages.ActivePage().Buffer().Reset();
3703+
// _renderer.TriggerFlush(false);
3704+
// //_pages.ActivePage().Buffer().Reset();
3705+
// }
3706+
}
3707+
36473708
// Method Description:
36483709
// - Performs a FinalTerm action
36493710
// - Currently, the actions we support are:

src/terminal/adapter/adaptDispatch.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ namespace Microsoft::Console::VirtualTerminal
151151

152152
void DoITerm2Action(const std::wstring_view string) override;
153153

154+
void DoWarpInBandGeneratorAction() override;
155+
156+
void DoWarpAction() override;
157+
158+
void DoWarpResetGridAction() override;
159+
154160
void DoFinalTermAction(const std::wstring_view string) override;
155161

156162
void DoVsCodeAction(const std::wstring_view string) override;

src/terminal/parser/OutputStateMachineEngine.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,10 @@ IStateMachineEngine::StringHandler OutputStateMachineEngine::ActionDcsDispatch(c
724724
case DcsActionCodes::DECRSPS_RestorePresentationState:
725725
handler = _dispatch->RestorePresentationState(parameters.at(0));
726726
break;
727+
case DcsActionCodes::DCS_WARP:
728+
_dispatch->DoWarpAction();
729+
handler = nullptr;
730+
break;
727731
default:
728732
handler = nullptr;
729733
break;
@@ -873,6 +877,21 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
873877
_dispatch->DoITerm2Action(string);
874878
break;
875879
}
880+
case OscActionCodes::WarpInBandGeneratorAction:
881+
{
882+
_dispatch->DoWarpInBandGeneratorAction();
883+
break;
884+
}
885+
case OscActionCodes::WarpAction:
886+
{
887+
_dispatch->DoWarpAction();
888+
break;
889+
}
890+
case OscActionCodes::WarpResetGridAction:
891+
{
892+
_dispatch->DoWarpResetGridAction();
893+
break;
894+
}
876895
case OscActionCodes::FinalTermAction:
877896
{
878897
_dispatch->DoFinalTermAction(string);

src/terminal/parser/OutputStateMachineEngine.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ namespace Microsoft::Console::VirtualTerminal
178178
DECRSTS_RestoreTerminalState = VTID("$p"),
179179
DECRQSS_RequestSetting = VTID("$q"),
180180
DECRSPS_RestorePresentationState = VTID("$t"),
181+
DCS_WARP = VTID("d"),
181182
};
182183

183184
enum Vt52ActionCodes : uint64_t
@@ -223,6 +224,9 @@ namespace Microsoft::Console::VirtualTerminal
223224
VsCodeAction = 633,
224225
ITerm2Action = 1337,
225226
WTAction = 9001,
227+
WarpInBandGeneratorAction = 9277,
228+
WarpAction = 9278,
229+
WarpResetGridAction = 9279,
226230
};
227231

228232
bool _GetOscSetColorTable(const std::wstring_view string,

0 commit comments

Comments
 (0)