Skip to content

Commit

Permalink
Comments and syntax cleanup per code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaykul committed May 24, 2019
1 parent 678f531 commit ea978ed
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
42 changes: 21 additions & 21 deletions src/terminal/adapter/adaptDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ bool AdaptDispatch::UseMainScreenBuffer()
//Arguments:
// - None
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::HorizontalTabSet()
{
return !!_conApi->PrivateHorizontalTabSet();
Expand All @@ -1403,7 +1403,7 @@ bool AdaptDispatch::HorizontalTabSet()
//Arguments:
// - sNumTabs - the number of tabs to perform
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::ForwardTab(const SHORT sNumTabs)
{
return !!_conApi->PrivateForwardTab(sNumTabs);
Expand All @@ -1415,7 +1415,7 @@ bool AdaptDispatch::ForwardTab(const SHORT sNumTabs)
//Arguments:
// - sNumTabs - the number of tabs to perform
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::BackwardsTab(const SHORT sNumTabs)
{
return !!_conApi->PrivateBackwardsTab(sNumTabs);
Expand All @@ -1428,7 +1428,7 @@ bool AdaptDispatch::BackwardsTab(const SHORT sNumTabs)
//Arguments:
// - sClearType - Whether to clear the current column, or all columns, defined in DispatchTypes::TabClearType
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::TabClear(const SHORT sClearType)
{
bool fSuccess = false;
Expand All @@ -1453,7 +1453,7 @@ bool AdaptDispatch::TabClear(const SHORT sClearType)
//Arguments:
// - wchCharset - The character indicating the charset we should switch to.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::DesignateCharset(const wchar_t wchCharset)
{
return _TermOutput.DesignateCharset(wchCharset);
Expand Down Expand Up @@ -1489,7 +1489,7 @@ bool AdaptDispatch::DesignateCharset(const wchar_t wchCharset)
//Arguments:
// <none>
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::SoftReset()
{
bool fSuccess = CursorVisibility(true); // Cursor enabled.
Expand Down Expand Up @@ -1542,7 +1542,7 @@ bool AdaptDispatch::SoftReset()
//Arguments:
// <none>
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::HardReset()
{
// Clears the screen - Needs to be done in two operations.
Expand Down Expand Up @@ -1581,7 +1581,7 @@ bool AdaptDispatch::HardReset()
//Arguments:
// <none>
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::_EraseScrollback()
{
CONSOLE_SCREEN_BUFFER_INFOEX csbiex = { 0 };
Expand Down Expand Up @@ -1667,7 +1667,7 @@ bool AdaptDispatch::_EraseScrollback()
//Arguments:
// <none>
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::_EraseAll()
{
return !!_conApi->PrivateEraseAll();
Expand All @@ -1678,7 +1678,7 @@ bool AdaptDispatch::_EraseAll()
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableVT200MouseMode(const bool fEnabled)
{
return !!_conApi->PrivateEnableVT200MouseMode(fEnabled);
Expand All @@ -1690,7 +1690,7 @@ bool AdaptDispatch::EnableVT200MouseMode(const bool fEnabled)
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool fEnabled)
{
return !!_conApi->PrivateEnableUTF8ExtendedMouseMode(fEnabled);
Expand All @@ -1702,7 +1702,7 @@ bool AdaptDispatch::EnableUTF8ExtendedMouseMode(const bool fEnabled)
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool fEnabled)
{
return !!_conApi->PrivateEnableSGRExtendedMouseMode(fEnabled);
Expand All @@ -1713,7 +1713,7 @@ bool AdaptDispatch::EnableSGRExtendedMouseMode(const bool fEnabled)
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableButtonEventMouseMode(const bool fEnabled)
{
return !!_conApi->PrivateEnableButtonEventMouseMode(fEnabled);
Expand All @@ -1725,7 +1725,7 @@ bool AdaptDispatch::EnableButtonEventMouseMode(const bool fEnabled)
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableAnyEventMouseMode(const bool fEnabled)
{
return !!_conApi->PrivateEnableAnyEventMouseMode(fEnabled);
Expand All @@ -1737,7 +1737,7 @@ bool AdaptDispatch::EnableAnyEventMouseMode(const bool fEnabled)
//Arguments:
// - fEnabled - true to enable, false to disable.
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::EnableAlternateScroll(const bool fEnabled)
{
return !!_conApi->PrivateEnableAlternateScroll(fEnabled);
Expand All @@ -1749,7 +1749,7 @@ bool AdaptDispatch::EnableAlternateScroll(const bool fEnabled)
//Arguments:
// - cursorStyle - The unix-like cursor style to apply to the cursor
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
{
bool isPty = false;
Expand Down Expand Up @@ -1808,7 +1808,7 @@ bool AdaptDispatch::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
// - tableIndex: The VT color table index
// - dwColor: The new RGB color value to use.
// Return Value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::SetCursorColor(const COLORREF cursorColor)
{
bool isPty = false;
Expand All @@ -1827,7 +1827,7 @@ bool AdaptDispatch::SetCursorColor(const COLORREF cursorColor)
// - tableIndex: The VT color table index
// - dwColor: The new RGB color value to use.
// Return Value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::SetColorTableEntry(const size_t tableIndex, const DWORD dwColor)
{

Expand Down Expand Up @@ -1857,7 +1857,7 @@ bool AdaptDispatch::SetColorTableEntry(const size_t tableIndex, const DWORD dwCo
// Arguments:
// - dwColor: The new RGB color value to use, as a COLORREF, format 0x00BBGGRR.
// Return Value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultForeground(const DWORD dwColor)
{
bool fSuccess = true;
Expand All @@ -1882,7 +1882,7 @@ bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultForeground(co
// Arguments:
// - dwColor: The new RGB color value to use, as a COLORREF, format 0x00BBGGRR.
// Return Value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultBackground(const DWORD dwColor)
{
bool fSuccess = true;
Expand Down Expand Up @@ -1913,7 +1913,7 @@ bool Microsoft::Console::VirtualTerminal::AdaptDispatch::SetDefaultBackground(co
// - rgusParams - Additional parameters to pass to the function
// - cParams - size of rgusParams
// Return value:
// True if handled successfully. False othewise.
// True if handled successfully. False otherwise.
bool AdaptDispatch::WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction,
_In_reads_(cParams) const unsigned short* const rgusParams,
const size_t cParams)
Expand Down
4 changes: 2 additions & 2 deletions src/terminal/adapter/adaptDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ namespace Microsoft::Console::VirtualTerminal
virtual bool SetCursorColor(const COLORREF cursorColor);

virtual bool SetColorTableEntry(const size_t tableIndex, const DWORD dwColor); // OscColorTable
virtual bool SetDefaultForeground(const DWORD /*dwColor*/); // OSCDefaultForeground
virtual bool SetDefaultBackground(const DWORD /*dwColor*/); // OSCDefaultBackground
virtual bool SetDefaultForeground(const DWORD dwColor); // OSCDefaultForeground
virtual bool SetDefaultBackground(const DWORD dwColor); // OSCDefaultBackground

virtual bool WindowManipulation(const DispatchTypes::WindowManipulationType uiFunction,
_In_reads_(cParams) const unsigned short* const rgusParams,
Expand Down
18 changes: 11 additions & 7 deletions src/terminal/adapter/ut_adapter/adapterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,23 +779,23 @@ class TestGetSet final : public ConGetSet
BOOL PrivateSetDefaultForeground(const COLORREF value) const noexcept override
{
Log::Comment(L"PrivateSetDefaultForeground MOCK called...");
if (_fPrivateSetDefaultColorResult)
if (_fPrivateSetDefaultForegroundResult)
{
VERIFY_ARE_EQUAL(_expectedColorValue, value);
VERIFY_ARE_EQUAL(_expectedDefaultForegroundColorValue, value);
}

return _fPrivateSetDefaultColorResult;
return _fPrivateSetDefaultForegroundResult;
}

BOOL PrivateSetDefaultBackground(const COLORREF value) const noexcept override
{
Log::Comment(L"PrivateSetDefaultForeground MOCK called...");
if (_fPrivateSetDefaultColorResult)
if (_fPrivateSetDefaultBackgroundResult)
{
VERIFY_ARE_EQUAL(_expectedColorValue, value);
VERIFY_ARE_EQUAL(_expectedDefaultBackgroundColorValue, value);
}

return _fPrivateSetDefaultColorResult;
return _fPrivateSetDefaultBackgroundResult;
}

void _IncrementCoordPos(_Inout_ COORD* pcoord)
Expand Down Expand Up @@ -1400,7 +1400,11 @@ class TestGetSet final : public ConGetSet
short _expectedColorTableIndex = -1;
COLORREF _expectedColorValue = INVALID_COLOR;

bool _fPrivateSetDefaultColorResult = false;
bool _fPrivateSetDefaultForegroundResult = false;
COLORREF _expectedDefaultForegroundColorValue = INVALID_COLOR;

bool _fPrivateSetDefaultBackgroundResult = false;
COLORREF _expectedDefaultBackgroundColorValue = INVALID_COLOR;

private:
HANDLE _hCon;
Expand Down
4 changes: 2 additions & 2 deletions src/terminal/parser/OutputStateMachineEngine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ namespace Microsoft::Console::VirtualTerminal
_Out_ DWORD* const pRgb);

bool _GetOscSetColor(_In_reads_(cchOscString) const wchar_t* const pwchOscStringBuffer,
const size_t cchOscString,
_Out_ DWORD* const pRgb) const;
const size_t cchOscString,
_Out_ DWORD* const pRgb) const;

static const DispatchTypes::CursorStyle s_defaultCursorStyle = DispatchTypes::CursorStyle::BlinkingBlockDefault;
_Success_(return)
Expand Down

0 comments on commit ea978ed

Please sign in to comment.