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

Reintroduce the check for VT_INPUT_MODE in AdaptDispatch #6485

Merged
2 commits merged into from
Jun 15, 2020
Merged
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
46 changes: 28 additions & 18 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,7 @@ bool AdaptDispatch::SetKeypadMode(const bool fApplicationMode)
bool success = true;
success = _pConApi->PrivateSetKeypadMode(fApplicationMode);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -1117,8 +1116,7 @@ bool AdaptDispatch::EnableWin32InputMode(const bool win32InputMode)
bool success = true;
success = _pConApi->PrivateEnableWin32InputMode(win32InputMode);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -1136,8 +1134,7 @@ bool AdaptDispatch::SetCursorKeysMode(const bool applicationMode)
bool success = true;
success = _pConApi->PrivateSetCursorKeysMode(applicationMode);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand Down Expand Up @@ -2045,8 +2042,7 @@ bool AdaptDispatch::EnableVT200MouseMode(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableVT200MouseMode(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -2066,8 +2062,7 @@ bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableUTF8ExtendedMouseMode(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -2087,8 +2082,7 @@ bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableSGRExtendedMouseMode(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -2107,8 +2101,7 @@ bool AdaptDispatch::EnableButtonEventMouseMode(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableButtonEventMouseMode(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -2128,8 +2121,7 @@ bool AdaptDispatch::EnableAnyEventMouseMode(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableAnyEventMouseMode(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand All @@ -2149,8 +2141,7 @@ bool AdaptDispatch::EnableAlternateScroll(const bool enabled)
bool success = true;
success = _pConApi->PrivateEnableAlternateScroll(enabled);

// If we're a conpty, always return false
if (_pConApi->IsConsolePty())
if (_ShouldPassThroughInputModeChange())
{
return false;
}
Expand Down Expand Up @@ -2341,3 +2332,22 @@ bool AdaptDispatch::WindowManipulation(const DispatchTypes::WindowManipulationTy

return success;
}

// Routine Description:
// - Determines whether we should pass any sequence that manipulates
// TerminalInput's input generator through the PTY. It encapsulates
// a check for whether the PTY is in use.
// Return value:
// True if the request should be passed.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// True if the request should be passed.
// - True if the request should be passed.

bool AdaptDispatch::_ShouldPassThroughInputModeChange() const
{
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always pass input mode requests
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
// output, but not Input.
// The original comment said, "Once the conpty supports these types of input,
// this check can be removed. See GH#4911". Unfortunately, time has shown
// us that SSH 7.7 _also_ requests mouse input and that can have a user interface
// impact on the actual connected terminal. We can't remove this check,
// because SSH <=7.7 is out in the wild on all versions of Windows <=2004.
return _pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled();
}
2 changes: 2 additions & 0 deletions src/terminal/adapter/adaptDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ namespace Microsoft::Console::VirtualTerminal
void _ResetTabStops() noexcept;
void _InitTabStopsForWidth(const size_t width);

bool _ShouldPassThroughInputModeChange() const;

std::vector<bool> _tabStopColumns;
bool _initDefaultTabStops = true;

Expand Down