Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Passthrough for VT Input Mode in ConPty #4856

Merged
2 commits merged into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
144 changes: 96 additions & 48 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,12 +1039,18 @@ bool AdaptDispatch::ResetPrivateModes(const std::basic_string_view<DispatchTypes
// - True if handled successfully. False otherwise.
bool AdaptDispatch::SetKeypadMode(const bool fApplicationMode)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateSetKeypadMode(fApplicationMode);
return false;
bool success = true;
success = _pConApi->PrivateSetKeypadMode(fApplicationMode);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

// - DECCKM - Sets the cursor keys input mode to either Application mode or Normal mode (true, false respectively)
Expand All @@ -1054,12 +1060,18 @@ bool AdaptDispatch::SetKeypadMode(const bool fApplicationMode)
// - True if handled successfully. False otherwise.
bool AdaptDispatch::SetCursorKeysMode(const bool applicationMode)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateSetCursorKeysMode(applicationMode);
return false;
bool success = true;
success = _pConApi->PrivateSetCursorKeysMode(applicationMode);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

// - att610 - Enables or disables the cursor blinking.
Expand Down Expand Up @@ -1698,12 +1710,18 @@ bool AdaptDispatch::EnableDECCOLMSupport(const bool enabled) noexcept
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableVT200MouseMode(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableVT200MouseMode(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableVT200MouseMode(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

//Routine Description:
Expand All @@ -1715,12 +1733,18 @@ bool AdaptDispatch::EnableVT200MouseMode(const bool enabled)
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableUTF8ExtendedMouseMode(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableUTF8ExtendedMouseMode(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

//Routine Description:
Expand All @@ -1732,12 +1756,18 @@ bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool enabled)
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableSGRExtendedMouseMode(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableSGRExtendedMouseMode(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

//Routine Description:
Expand All @@ -1748,12 +1778,18 @@ bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool enabled)
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableButtonEventMouseMode(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableButtonEventMouseMode(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableButtonEventMouseMode(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

//Routine Description:
Expand All @@ -1765,12 +1801,18 @@ bool AdaptDispatch::EnableButtonEventMouseMode(const bool enabled)
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableAnyEventMouseMode(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableAnyEventMouseMode(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableAnyEventMouseMode(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}

return success;
}

//Routine Description:
Expand All @@ -1782,12 +1824,18 @@ bool AdaptDispatch::EnableAnyEventMouseMode(const bool enabled)
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableAlternateScroll(const bool enabled)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Replace with proper _pConApi
// call below when ConPty has been properly updated.
_pConApi->PrivateEnableAlternateScroll(enabled);
return false;
bool success = true;
success = _pConApi->PrivateEnableAlternateScroll(enabled);

// If we're a conpty, always return false
bool isPty = false;
_pConApi->IsConsolePty(isPty);
if (isPty)
{
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

god, this API is needlessly verbose ;)

i hope when somebody fixes IsConsolePty to return a bool, they come fix all of these


return success;
}

//Routine Description:
Expand Down
2 changes: 1 addition & 1 deletion src/terminal/adapter/ut_adapter/adapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class TestGetSet final : public ConGetSet

bool PrivateIsVtInputEnabled() const override
{
return true;
return false;
}

bool PrivateSetLegacyAttributes(const WORD attr, const bool foreground, const bool background, const bool meta) override
Expand Down
4 changes: 0 additions & 4 deletions src/terminal/parser/InputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,6 @@ bool InputStateMachineEngine::ActionPrintString(const std::wstring_view string)
// - true iff we successfully dispatched the sequence.
bool InputStateMachineEngine::ActionPassThroughString(const std::wstring_view string)
{
// TODO GH#XXXX:
// This is a temporary replacement to enable passhthrough
// mode for Windows Terminal. Remove IsVtInputEnabled() logic
// when ConPty learns to handle mouse input properly
if (_pDispatch->IsVtInputEnabled())
{
// Synthesize string into key events that we'll write to the buffer
Expand Down