mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-12 18:41:01 -06:00
Only passthrough input changes if the client's in VT input mode (#4913)
Closes #4911.
This commit is contained in:
parent
5a1b7b664b
commit
57a80aa531
@ -769,14 +769,17 @@ bool ConhostInternalGetSet::SetCursorColor(const COLORREF cursorColor)
|
|||||||
|
|
||||||
// Routine Description:
|
// Routine Description:
|
||||||
// - Connects the IsConsolePty call directly into our Driver Message servicing call inside Conhost.exe
|
// - Connects the IsConsolePty call directly into our Driver Message servicing call inside Conhost.exe
|
||||||
|
// - NOTE: This ONE method behaves differently! The rest of the methods on this
|
||||||
|
// interface return true if successful. This one just returns the result.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// - isPty: receives the bool indicating whether or not we're in pty mode.
|
// - isPty: receives the bool indicating whether or not we're in pty mode.
|
||||||
// Return Value:
|
// Return Value:
|
||||||
// - true if successful (see DoSrvIsConsolePty). false otherwise.
|
// - true if we're in pty mode.
|
||||||
bool ConhostInternalGetSet::IsConsolePty(bool& isPty) const
|
bool ConhostInternalGetSet::IsConsolePty() const
|
||||||
{
|
{
|
||||||
|
bool isPty = false;
|
||||||
DoSrvIsConsolePty(isPty);
|
DoSrvIsConsolePty(isPty);
|
||||||
return true;
|
return isPty;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConhostInternalGetSet::DeleteLines(const size_t count)
|
bool ConhostInternalGetSet::DeleteLines(const size_t count)
|
||||||
|
|||||||
@ -143,7 +143,7 @@ public:
|
|||||||
|
|
||||||
bool GetConsoleOutputCP(unsigned int& codepage) override;
|
bool GetConsoleOutputCP(unsigned int& codepage) override;
|
||||||
|
|
||||||
bool IsConsolePty(bool& isPty) const override;
|
bool IsConsolePty() const override;
|
||||||
|
|
||||||
bool DeleteLines(const size_t count) override;
|
bool DeleteLines(const size_t count) override;
|
||||||
bool InsertLines(const size_t count) override;
|
bool InsertLines(const size_t count) override;
|
||||||
|
|||||||
@ -583,8 +583,7 @@ bool AdaptDispatch::EraseInDisplay(const DispatchTypes::EraseType eraseType)
|
|||||||
// make the state machine propogate this ED sequence to the connected
|
// make the state machine propogate this ED sequence to the connected
|
||||||
// terminal application. While we're in conpty mode, we don't really
|
// terminal application. While we're in conpty mode, we don't really
|
||||||
// have a scrollback, but the attached terminal might.
|
// have a scrollback, but the attached terminal might.
|
||||||
bool isPty = false;
|
const bool isPty = _pConApi->IsConsolePty();
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
return eraseScrollbackResult && (!isPty);
|
return eraseScrollbackResult && (!isPty);
|
||||||
}
|
}
|
||||||
else if (eraseType == DispatchTypes::EraseType::All)
|
else if (eraseType == DispatchTypes::EraseType::All)
|
||||||
@ -1042,10 +1041,11 @@ bool AdaptDispatch::SetKeypadMode(const bool fApplicationMode)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateSetKeypadMode(fApplicationMode);
|
success = _pConApi->PrivateSetKeypadMode(fApplicationMode);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1063,10 +1063,11 @@ bool AdaptDispatch::SetCursorKeysMode(const bool applicationMode)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateSetCursorKeysMode(applicationMode);
|
success = _pConApi->PrivateSetCursorKeysMode(applicationMode);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1558,9 +1559,7 @@ bool AdaptDispatch::HardReset()
|
|||||||
// make the state machine propogate this RIS sequence to the connected
|
// make the state machine propogate this RIS sequence to the connected
|
||||||
// terminal application. We've reset our state, but the connected terminal
|
// terminal application. We've reset our state, but the connected terminal
|
||||||
// might need to do more.
|
// might need to do more.
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1713,10 +1712,11 @@ bool AdaptDispatch::EnableVT200MouseMode(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableVT200MouseMode(enabled);
|
success = _pConApi->PrivateEnableVT200MouseMode(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1736,10 +1736,11 @@ bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableUTF8ExtendedMouseMode(enabled);
|
success = _pConApi->PrivateEnableUTF8ExtendedMouseMode(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1759,10 +1760,11 @@ bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableSGRExtendedMouseMode(enabled);
|
success = _pConApi->PrivateEnableSGRExtendedMouseMode(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1781,10 +1783,11 @@ bool AdaptDispatch::EnableButtonEventMouseMode(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableButtonEventMouseMode(enabled);
|
success = _pConApi->PrivateEnableButtonEventMouseMode(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1804,10 +1807,11 @@ bool AdaptDispatch::EnableAnyEventMouseMode(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableAnyEventMouseMode(enabled);
|
success = _pConApi->PrivateEnableAnyEventMouseMode(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1827,10 +1831,11 @@ bool AdaptDispatch::EnableAlternateScroll(const bool enabled)
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
success = _pConApi->PrivateEnableAlternateScroll(enabled);
|
success = _pConApi->PrivateEnableAlternateScroll(enabled);
|
||||||
|
|
||||||
// If we're a conpty, always return false
|
// If we're a conpty, AND WE'RE IN VT INPUT MODE, always return false
|
||||||
bool isPty = false;
|
// The VT Input mode check is to work around ssh.exe v7.7, which uses VT
|
||||||
_pConApi->IsConsolePty(isPty);
|
// output, but not Input. Once the conpty supports these types of input,
|
||||||
if (isPty)
|
// this check can be removed. See GH#4911
|
||||||
|
if (_pConApi->IsConsolePty() && _pConApi->PrivateIsVtInputEnabled())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1889,9 +1894,7 @@ bool AdaptDispatch::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
|
|||||||
|
|
||||||
// If we're a conpty, always return false, so that this cursor state will be
|
// If we're a conpty, always return false, so that this cursor state will be
|
||||||
// sent to the connected terminal
|
// sent to the connected terminal
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1908,9 +1911,7 @@ bool AdaptDispatch::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
|
|||||||
// True if handled successfully. False otherwise.
|
// True if handled successfully. False otherwise.
|
||||||
bool AdaptDispatch::SetCursorColor(const COLORREF cursorColor)
|
bool AdaptDispatch::SetCursorColor(const COLORREF cursorColor)
|
||||||
{
|
{
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1938,9 +1939,7 @@ bool AdaptDispatch::SetColorTableEntry(const size_t tableIndex, const DWORD dwCo
|
|||||||
// value to the terminal. Still handle the sequence so apps that use
|
// value to the terminal. Still handle the sequence so apps that use
|
||||||
// the API or VT to query the values of the color table still read the
|
// the API or VT to query the values of the color table still read the
|
||||||
// correct color.
|
// correct color.
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1963,9 +1962,7 @@ bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultForeground(co
|
|||||||
// value to the terminal. Still handle the sequence so apps that use
|
// value to the terminal. Still handle the sequence so apps that use
|
||||||
// the API or VT to query the values of the color table still read the
|
// the API or VT to query the values of the color table still read the
|
||||||
// correct color.
|
// correct color.
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1988,9 +1985,7 @@ bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultBackground(co
|
|||||||
// value to the terminal. Still handle the sequence so apps that use
|
// value to the terminal. Still handle the sequence so apps that use
|
||||||
// the API or VT to query the values of the color table still read the
|
// the API or VT to query the values of the color table still read the
|
||||||
// correct color.
|
// correct color.
|
||||||
bool isPty = false;
|
if (_pConApi->IsConsolePty())
|
||||||
_pConApi->IsConsolePty(isPty);
|
|
||||||
if (isPty)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -98,7 +98,7 @@ namespace Microsoft::Console::VirtualTerminal
|
|||||||
virtual bool GetConsoleOutputCP(unsigned int& codepage) = 0;
|
virtual bool GetConsoleOutputCP(unsigned int& codepage) = 0;
|
||||||
|
|
||||||
virtual bool PrivateSuppressResizeRepaint() = 0;
|
virtual bool PrivateSuppressResizeRepaint() = 0;
|
||||||
virtual bool IsConsolePty(bool& isPty) const = 0;
|
virtual bool IsConsolePty() const = 0;
|
||||||
|
|
||||||
virtual bool DeleteLines(const size_t count) = 0;
|
virtual bool DeleteLines(const size_t count) = 0;
|
||||||
virtual bool InsertLines(const size_t count) = 0;
|
virtual bool InsertLines(const size_t count) = 0;
|
||||||
|
|||||||
@ -610,14 +610,10 @@ public:
|
|||||||
return _getConsoleOutputCPResult;
|
return _getConsoleOutputCPResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsConsolePty(bool& isPty) const override
|
bool IsConsolePty() const override
|
||||||
{
|
{
|
||||||
Log::Comment(L"IsConsolePty MOCK called...");
|
Log::Comment(L"IsConsolePty MOCK called...");
|
||||||
if (_isConsolePtyResult)
|
return _isPty;
|
||||||
{
|
|
||||||
isPty = _isPty;
|
|
||||||
}
|
|
||||||
return _isConsolePtyResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeleteLines(const size_t /*count*/) override
|
bool DeleteLines(const size_t /*count*/) override
|
||||||
@ -951,7 +947,6 @@ public:
|
|||||||
bool _setCursorColorResult = false;
|
bool _setCursorColorResult = false;
|
||||||
COLORREF _expectedCursorColor = 0;
|
COLORREF _expectedCursorColor = 0;
|
||||||
bool _getConsoleOutputCPResult = false;
|
bool _getConsoleOutputCPResult = false;
|
||||||
bool _isConsolePtyResult = false;
|
|
||||||
bool _privateSetDefaultAttributesResult = false;
|
bool _privateSetDefaultAttributesResult = false;
|
||||||
bool _moveToBottomResult = false;
|
bool _moveToBottomResult = false;
|
||||||
|
|
||||||
@ -2270,7 +2265,6 @@ public:
|
|||||||
|
|
||||||
// Test in pty mode - we should fail, but PrivateSetColorTableEntry should still be called
|
// Test in pty mode - we should fail, but PrivateSetColorTableEntry should still be called
|
||||||
_testGetSet->_isPty = true;
|
_testGetSet->_isPty = true;
|
||||||
_testGetSet->_isConsolePtyResult = true;
|
|
||||||
|
|
||||||
_testGetSet->_expectedColorTableIndex = 15; // Windows BRIGHT_WHITE
|
_testGetSet->_expectedColorTableIndex = 15; // Windows BRIGHT_WHITE
|
||||||
VERIFY_IS_FALSE(_pDispatch.get()->SetColorTableEntry(15, testColor));
|
VERIFY_IS_FALSE(_pDispatch.get()->SetColorTableEntry(15, testColor));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user