Skip to content

Commit

Permalink
Revert "Add support for the DECREQTPARM report (#7939)"
Browse files Browse the repository at this point in the history
This reverts commit 74678ff.
  • Loading branch information
DHowett committed Oct 27, 2020
1 parent 136db72 commit 596597b
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 125 deletions.
1 change: 0 additions & 1 deletion .github/actions/spell-check/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ DECOM
deconstructed
DECPCTERM
DECRC
DECREQTPARM
DECRLM
DECRQM
DECRST
Expand Down
6 changes: 0 additions & 6 deletions src/terminal/adapter/DispatchTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ namespace Microsoft::Console::VirtualTerminal::DispatchTypes
SteadyBar = 6
};

enum class ReportingPermission : size_t
{
Unsolicited = 0,
Solicited = 1
};

enum class LineFeedType : unsigned int
{
WithReturn,
Expand Down
1 change: 0 additions & 1 deletion src/terminal/adapter/ITermDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class Microsoft::Console::VirtualTerminal::ITermDispatch
virtual bool SecondaryDeviceAttributes() = 0; // DA2
virtual bool TertiaryDeviceAttributes() = 0; // DA3
virtual bool Vt52DeviceAttributes() = 0; // VT52 Identify
virtual bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) = 0; // DECREQTPARM

virtual bool DesignateCodingSystem(const VTID codingSystem) = 0; // DOCS
virtual bool Designate94Charset(const size_t gsetNumber, const VTID charset) = 0; // SCS
Expand Down
34 changes: 0 additions & 34 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,40 +769,6 @@ bool AdaptDispatch::Vt52DeviceAttributes()
return _WriteResponse(L"\x1b/Z");
}

// Routine Description:
// - DECREQTPARM - This sequence was originally used on the VT100 terminal to
// report the serial communication parameters (baud rate, data bits, parity,
// etc.). On modern terminal emulators, the response is simply hardcoded.
// Arguments:
// - permission - This would originally have determined whether the terminal
// was allowed to send unsolicited reports or not.
// Return Value:
// - True if handled successfully. False otherwise.
bool AdaptDispatch::RequestTerminalParameters(const DispatchTypes::ReportingPermission permission)
{
// We don't care whether unsolicited reports are allowed or not, but the
// requested permission does determine the value of the first response
// parameter. The remaining parameters are just hardcoded to indicate a
// 38400 baud connection, which matches the XTerm response. The full
// parameter sequence is as follows:
// - response type: 2 or 3 (unsolicited or solicited)
// - parity: 1 (no parity)
// - data bits: 1 (8 bits per character)
// - transmit speed: 128 (38400 baud)
// - receive speed: 128 (38400 baud)
// - clock multiplier: 1
// - flags: 0
switch (permission)
{
case DispatchTypes::ReportingPermission::Unsolicited:
return _WriteResponse(L"\x1b[2;1;1;128;128;1;0x");
case DispatchTypes::ReportingPermission::Solicited:
return _WriteResponse(L"\x1b[3;1;1;128;128;1;0x");
default:
return false;
}
}

// Routine Description:
// - DSR-OS - Reports the operating status back to the input channel
// Arguments:
Expand Down
1 change: 0 additions & 1 deletion src/terminal/adapter/adaptDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace Microsoft::Console::VirtualTerminal
bool SecondaryDeviceAttributes() override; // DA2
bool TertiaryDeviceAttributes() override; // DA3
bool Vt52DeviceAttributes() override; // VT52 Identify
bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) override; // DECREQTPARM
bool ScrollUp(const size_t distance) override; // SU
bool ScrollDown(const size_t distance) override; // SD
bool InsertLine(const size_t distance) override; // IL
Expand Down
1 change: 0 additions & 1 deletion src/terminal/adapter/termDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class Microsoft::Console::VirtualTerminal::TermDispatch : public Microsoft::Cons
bool SecondaryDeviceAttributes() noexcept override { return false; } // DA2
bool TertiaryDeviceAttributes() noexcept override { return false; } // DA3
bool Vt52DeviceAttributes() noexcept override { return false; } // VT52 Identify
bool RequestTerminalParameters(const DispatchTypes::ReportingPermission /*permission*/) noexcept override { return false; } // DECREQTPARM

bool DesignateCodingSystem(const VTID /*codingSystem*/) noexcept override { return false; } // DOCS
bool Designate94Charset(const size_t /*gsetNumber*/, const VTID /*charset*/) noexcept override { return false; } // SCS
Expand Down
24 changes: 0 additions & 24 deletions src/terminal/adapter/ut_adapter/adapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1823,30 +1823,6 @@ class AdapterTest
VERIFY_IS_FALSE(_pDispatch.get()->TertiaryDeviceAttributes());
}

TEST_METHOD(RequestTerminalParametersTests)
{
Log::Comment(L"Starting test...");

Log::Comment(L"Test 1: Verify response for unsolicited permission.");
_testGetSet->PrepData();
VERIFY_IS_TRUE(_pDispatch.get()->RequestTerminalParameters(DispatchTypes::ReportingPermission::Unsolicited));
_testGetSet->ValidateInputEvent(L"\x1b[2;1;1;128;128;1;0x");

Log::Comment(L"Test 2: Verify response for solicited permission.");
_testGetSet->PrepData();
VERIFY_IS_TRUE(_pDispatch.get()->RequestTerminalParameters(DispatchTypes::ReportingPermission::Solicited));
_testGetSet->ValidateInputEvent(L"\x1b[3;1;1;128;128;1;0x");

Log::Comment(L"Test 3: Verify failure with invalid parameter.");
_testGetSet->PrepData();
VERIFY_IS_FALSE(_pDispatch.get()->RequestTerminalParameters((DispatchTypes::ReportingPermission)2));

Log::Comment(L"Test 4: Verify failure when WriteConsoleInput doesn't work.");
_testGetSet->PrepData();
_testGetSet->_privateWriteConsoleInputWResult = FALSE;
VERIFY_IS_FALSE(_pDispatch.get()->RequestTerminalParameters(DispatchTypes::ReportingPermission::Unsolicited));
}

TEST_METHOD(CursorKeysModeTest)
{
Log::Comment(L"Starting test...");
Expand Down
4 changes: 0 additions & 4 deletions src/terminal/parser/OutputStateMachineEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,6 @@ bool OutputStateMachineEngine::ActionCsiDispatch(const VTID id, gsl::span<const
case CsiActionCodes::DA3_TertiaryDeviceAttributes:
success = _VerifyDeviceAttributesParams(parameters);
break;
case CsiActionCodes::DECREQTPARM_RequestTerminalParameters:
success = _dispatch->RequestTerminalParameters(parameters.at(0));
TermTelemetry::Instance().Log(TermTelemetry::Codes::DECREQTPARM);
break;
case CsiActionCodes::SU_ScrollUp:
case CsiActionCodes::SD_ScrollDown:
success = _GetScrollDistance(parameters, distance);
Expand Down
1 change: 0 additions & 1 deletion src/terminal/parser/OutputStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ namespace Microsoft::Console::VirtualTerminal
ANSISYSSC_CursorSave = VTID("s"), // NOTE: Overlaps with DECLRMM/DECSLRM. Fix when/if implemented.
DTTERM_WindowManipulation = VTID("t"), // NOTE: Overlaps with DECSLPP. Fix when/if implemented.
ANSISYSRC_CursorRestore = VTID("u"),
DECREQTPARM_RequestTerminalParameters = VTID("x"),
DECSCUSR_SetCursorStyle = VTID(" q"),
DECSTR_SoftReset = VTID("!p"),
DECSCPP_SetColumnsPerPage = VTID("$|")
Expand Down
1 change: 0 additions & 1 deletion src/terminal/parser/telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ void TermTelemetry::WriteFinalTraceLog() const
TraceLoggingUInt32(_uiTimesUsed[DA], "DA"),
TraceLoggingUInt32(_uiTimesUsed[DA2], "DA2"),
TraceLoggingUInt32(_uiTimesUsed[DA3], "DA3"),
TraceLoggingUInt32(_uiTimesUsed[DECREQTPARM], "DECREQTPARM"),
TraceLoggingUInt32(_uiTimesUsed[VPA], "VPA"),
TraceLoggingUInt32(_uiTimesUsed[HPR], "HPR"),
TraceLoggingUInt32(_uiTimesUsed[VPR], "VPR"),
Expand Down
1 change: 0 additions & 1 deletion src/terminal/parser/telemetry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ namespace Microsoft::Console::VirtualTerminal
DA,
DA2,
DA3,
DECREQTPARM,
VPA,
HPR,
VPR,
Expand Down
50 changes: 0 additions & 50 deletions src/terminal/parser/ut_parser/OutputEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,8 +991,6 @@ class StatefulDispatch final : public TermDispatch
_secondaryDeviceAttributes{ false },
_tertiaryDeviceAttributes{ false },
_vt52DeviceAttributes{ false },
_requestTerminalParameters{ false },
_reportingPermission{ (DispatchTypes::ReportingPermission)-1 },
_isAltBuffer{ false },
_cursorKeysMode{ false },
_cursorBlinking{ true },
Expand Down Expand Up @@ -1190,14 +1188,6 @@ class StatefulDispatch final : public TermDispatch
return true;
}

bool RequestTerminalParameters(const DispatchTypes::ReportingPermission permission) noexcept override
{
_requestTerminalParameters = true;
_reportingPermission = permission;

return true;
}

bool _PrivateModeParamsHelper(_In_ DispatchTypes::PrivateModeParams const param, const bool fEnable)
{
bool fSuccess = false;
Expand Down Expand Up @@ -1419,8 +1409,6 @@ class StatefulDispatch final : public TermDispatch
bool _secondaryDeviceAttributes;
bool _tertiaryDeviceAttributes;
bool _vt52DeviceAttributes;
bool _requestTerminalParameters;
DispatchTypes::ReportingPermission _reportingPermission;
bool _isAltBuffer;
bool _cursorKeysMode;
bool _cursorBlinking;
Expand Down Expand Up @@ -2331,44 +2319,6 @@ class StateMachineExternalTest final
pDispatch->ClearState();
}

TEST_METHOD(TestRequestTerminalParameters)
{
auto dispatch = std::make_unique<StatefulDispatch>();
auto pDispatch = dispatch.get();
auto engine = std::make_unique<OutputStateMachineEngine>(std::move(dispatch));
StateMachine mach(std::move(engine));

Log::Comment(L"Test 1: Check default case, no params.");
mach.ProcessCharacter(AsciiChars::ESC);
mach.ProcessCharacter(L'[');
mach.ProcessCharacter(L'x');

VERIFY_IS_TRUE(pDispatch->_requestTerminalParameters);
VERIFY_ARE_EQUAL(DispatchTypes::ReportingPermission::Unsolicited, pDispatch->_reportingPermission);

pDispatch->ClearState();

Log::Comment(L"Test 2: Check unsolicited permission, 0 param.");
mach.ProcessCharacter(AsciiChars::ESC);
mach.ProcessCharacter(L'[');
mach.ProcessCharacter(L'0');
mach.ProcessCharacter(L'x');

VERIFY_IS_TRUE(pDispatch->_requestTerminalParameters);
VERIFY_ARE_EQUAL(DispatchTypes::ReportingPermission::Unsolicited, pDispatch->_reportingPermission);

Log::Comment(L"Test 3: Check solicited permission, 1 param.");
mach.ProcessCharacter(AsciiChars::ESC);
mach.ProcessCharacter(L'[');
mach.ProcessCharacter(L'1');
mach.ProcessCharacter(L'x');

VERIFY_IS_TRUE(pDispatch->_requestTerminalParameters);
VERIFY_ARE_EQUAL(DispatchTypes::ReportingPermission::Solicited, pDispatch->_reportingPermission);

pDispatch->ClearState();
}

TEST_METHOD(TestStrings)
{
auto dispatch = std::make_unique<StatefulDispatch>();
Expand Down

0 comments on commit 596597b

Please sign in to comment.