Merge cursor color into color table.
This commit is contained in:
parent
6ebcb5eaed
commit
7004ba73db
|
@ -67,7 +67,8 @@ public:
|
|||
|
||||
static constexpr size_t DEFAULT_FOREGROUND = 256;
|
||||
static constexpr size_t DEFAULT_BACKGROUND = 257;
|
||||
static constexpr size_t TABLE_SIZE = 258;
|
||||
static constexpr size_t CURSOR_COLOR = 258;
|
||||
static constexpr size_t TABLE_SIZE = 259;
|
||||
|
||||
constexpr TextColor() noexcept :
|
||||
_meta{ ColorType::IsDefault },
|
||||
|
|
|
@ -27,9 +27,7 @@ Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept :
|
|||
_fDeferCursorRedraw(false),
|
||||
_fHaveDeferredCursorRedraw(false),
|
||||
_ulSize(ulSize),
|
||||
_cursorType(CursorType::Legacy),
|
||||
_fUseColor(false),
|
||||
_color(s_InvertCursorColor)
|
||||
_cursorType(CursorType::Legacy)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -143,10 +141,9 @@ void Cursor::SetSize(const ULONG ulSize) noexcept
|
|||
_RedrawCursor();
|
||||
}
|
||||
|
||||
void Cursor::SetStyle(const ULONG ulSize, const COLORREF color, const CursorType type) noexcept
|
||||
void Cursor::SetStyle(const ULONG ulSize, const CursorType type) noexcept
|
||||
{
|
||||
_ulSize = ulSize;
|
||||
_color = color;
|
||||
_cursorType = type;
|
||||
|
||||
_RedrawCursor();
|
||||
|
@ -285,7 +282,6 @@ void Cursor::CopyProperties(const Cursor& OtherCursor) noexcept
|
|||
// Size will be handled separately in the resize operation.
|
||||
//_ulSize = OtherCursor._ulSize;
|
||||
_cursorType = OtherCursor._cursorType;
|
||||
_color = OtherCursor._color;
|
||||
}
|
||||
|
||||
void Cursor::DelayEOLWrap(const COORD coordDelayedAt) noexcept
|
||||
|
@ -335,21 +331,6 @@ const CursorType Cursor::GetType() const noexcept
|
|||
return _cursorType;
|
||||
}
|
||||
|
||||
const bool Cursor::IsUsingColor() const noexcept
|
||||
{
|
||||
return GetColor() != INVALID_COLOR;
|
||||
}
|
||||
|
||||
const COLORREF Cursor::GetColor() const noexcept
|
||||
{
|
||||
return _color;
|
||||
}
|
||||
|
||||
void Cursor::SetColor(const unsigned int color) noexcept
|
||||
{
|
||||
_color = gsl::narrow_cast<COLORREF>(color);
|
||||
}
|
||||
|
||||
void Cursor::SetType(const CursorType type) noexcept
|
||||
{
|
||||
_cursorType = type;
|
||||
|
|
|
@ -24,7 +24,6 @@ class TextBuffer;
|
|||
class Cursor final
|
||||
{
|
||||
public:
|
||||
static const unsigned int s_InvertCursorColor = INVALID_COLOR;
|
||||
// the following values are used to create the textmode cursor.
|
||||
static constexpr unsigned int CURSOR_SMALL_SIZE = 25; // large enough to be one pixel on a six pixel font
|
||||
|
||||
|
@ -51,8 +50,6 @@ public:
|
|||
COORD GetPosition() const noexcept;
|
||||
|
||||
const CursorType GetType() const noexcept;
|
||||
const bool IsUsingColor() const noexcept;
|
||||
const COLORREF GetColor() const noexcept;
|
||||
|
||||
void StartDeferDrawing() noexcept;
|
||||
bool IsDeferDrawing() noexcept;
|
||||
|
@ -67,7 +64,7 @@ public:
|
|||
void SetIsPopupShown(const bool fIsPopupShown) noexcept;
|
||||
void SetDelay(const bool fDelay) noexcept;
|
||||
void SetSize(const ULONG ulSize) noexcept;
|
||||
void SetStyle(const ULONG ulSize, const COLORREF color, const CursorType type) noexcept;
|
||||
void SetStyle(const ULONG ulSize, const CursorType type) noexcept;
|
||||
|
||||
void SetPosition(const COORD cPosition) noexcept;
|
||||
void SetXPosition(const int NewX) noexcept;
|
||||
|
@ -84,7 +81,6 @@ public:
|
|||
COORD GetDelayedAtPosition() const noexcept;
|
||||
bool IsDelayedEOLWrap() const noexcept;
|
||||
|
||||
void SetColor(const unsigned int color) noexcept;
|
||||
void SetType(const CursorType type) noexcept;
|
||||
|
||||
private:
|
||||
|
@ -117,6 +113,4 @@ private:
|
|||
void _RedrawCursorAlways() noexcept;
|
||||
|
||||
CursorType _cursorType;
|
||||
bool _fUseColor;
|
||||
COLORREF _color;
|
||||
};
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace Microsoft::Terminal::Core
|
|||
virtual bool SetColorTableEntry(const size_t tableIndex, const COLORREF color) noexcept = 0;
|
||||
|
||||
virtual bool SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle) noexcept = 0;
|
||||
virtual bool SetCursorColor(const DWORD color) noexcept = 0;
|
||||
|
||||
virtual bool SetInputMode(const ::Microsoft::Console::VirtualTerminal::TerminalInput::Mode mode, const bool enabled) noexcept = 0;
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ Terminal::Terminal() :
|
|||
|
||||
_colorTable.at(TextColor::DEFAULT_FOREGROUND) = RGB(255, 255, 255);
|
||||
_colorTable.at(TextColor::DEFAULT_BACKGROUND) = ARGB(0, 0, 0, 0);
|
||||
_colorTable.at(TextColor::CURSOR_COLOR) = INVALID_COLOR;
|
||||
}
|
||||
|
||||
void Terminal::Create(COORD viewportSize, SHORT scrollbackLines, IRenderTarget& renderTarget)
|
||||
|
@ -185,6 +186,8 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
|||
_colorTable.at(TextColor::DEFAULT_BACKGROUND) = newBackgroundColor.with_alpha(0);
|
||||
const til::color newForegroundColor{ appearance.DefaultForeground() };
|
||||
_colorTable.at(TextColor::DEFAULT_FOREGROUND) = newForegroundColor;
|
||||
const til::color newCursorColor{ appearance.CursorColor() };
|
||||
_colorTable.at(TextColor::CURSOR_COLOR) = newCursorColor;
|
||||
|
||||
_intenseIsBright = appearance.IntenseIsBright();
|
||||
_adjustIndistinguishableColors = appearance.AdjustIndistinguishableColors();
|
||||
|
@ -224,9 +227,7 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
|
|||
|
||||
if (_buffer)
|
||||
{
|
||||
_buffer->GetCursor().SetStyle(appearance.CursorHeight(),
|
||||
til::color{ appearance.CursorColor() },
|
||||
cursorShape);
|
||||
_buffer->GetCursor().SetStyle(appearance.CursorHeight(), cursorShape);
|
||||
}
|
||||
|
||||
_defaultCursorShape = cursorShape;
|
||||
|
|
|
@ -109,7 +109,6 @@ public:
|
|||
COLORREF GetColorTableEntry(const size_t tableIndex) const noexcept override;
|
||||
bool SetColorTableEntry(const size_t tableIndex, const COLORREF color) noexcept override;
|
||||
bool SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle) noexcept override;
|
||||
bool SetCursorColor(const COLORREF color) noexcept override;
|
||||
|
||||
bool SetInputMode(const ::Microsoft::Console::VirtualTerminal::TerminalInput::Mode mode, const bool enabled) noexcept override;
|
||||
|
||||
|
|
|
@ -69,14 +69,6 @@ COORD Terminal::GetCursorPosition() noexcept
|
|||
return newPos;
|
||||
}
|
||||
|
||||
bool Terminal::SetCursorColor(const COLORREF color) noexcept
|
||||
try
|
||||
{
|
||||
_buffer->GetCursor().SetColor(color);
|
||||
return true;
|
||||
}
|
||||
CATCH_RETURN_FALSE()
|
||||
|
||||
// Method Description:
|
||||
// - Moves the cursor down one line, and possibly also to the leftmost column.
|
||||
// Arguments:
|
||||
|
|
|
@ -227,7 +227,7 @@ CATCH_LOG_RETURN_FALSE()
|
|||
bool TerminalDispatch::SetCursorColor(const DWORD color) noexcept
|
||||
try
|
||||
{
|
||||
return _terminalApi.SetCursorColor(color);
|
||||
return _terminalApi.SetColorTableEntry(TextColor::CURSOR_COLOR, color);
|
||||
}
|
||||
CATCH_LOG_RETURN_FALSE()
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ CursorType Terminal::GetCursorStyle() const noexcept
|
|||
|
||||
COLORREF Terminal::GetCursorColor() const noexcept
|
||||
{
|
||||
return _buffer->GetCursor().GetColor();
|
||||
return _colorTable.at(TextColor::CURSOR_COLOR);
|
||||
}
|
||||
|
||||
bool Terminal::IsCursorDoubleWidth() const
|
||||
|
|
|
@ -1499,12 +1499,6 @@ void DoSrvSetCursorStyle(SCREEN_INFORMATION& screenInfo,
|
|||
screenInfo.GetActiveBuffer().GetTextBuffer().GetCursor().SetType(cursorType);
|
||||
}
|
||||
|
||||
void DoSrvSetCursorColor(SCREEN_INFORMATION& screenInfo,
|
||||
const COLORREF cursorColor)
|
||||
{
|
||||
screenInfo.GetActiveBuffer().GetTextBuffer().GetCursor().SetColor(cursorColor);
|
||||
}
|
||||
|
||||
void DoSrvAddHyperlink(SCREEN_INFORMATION& screenInfo,
|
||||
const std::wstring_view uri,
|
||||
const std::wstring_view params)
|
||||
|
|
|
@ -36,8 +36,6 @@ void DoSrvPrivateUseMainScreenBuffer(SCREEN_INFORMATION& screenInfo);
|
|||
|
||||
void DoSrvSetCursorStyle(SCREEN_INFORMATION& screenInfo,
|
||||
const CursorType cursorType);
|
||||
void DoSrvSetCursorColor(SCREEN_INFORMATION& screenInfo,
|
||||
const COLORREF cursorColor);
|
||||
|
||||
void DoSrvAddHyperlink(SCREEN_INFORMATION& screenInfo,
|
||||
const std::wstring_view uri,
|
||||
|
|
|
@ -552,21 +552,6 @@ bool ConhostInternalGetSet::PrivateSuppressResizeRepaint()
|
|||
return SUCCEEDED(DoSrvPrivateSuppressResizeRepaint());
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Connects the SetCursorStyle call directly into our Driver Message servicing call inside Conhost.exe
|
||||
// SetCursorStyle is an internal-only "API" call that the vt commands can execute,
|
||||
// but it is not represented as a function call on our public API surface.
|
||||
// Arguments:
|
||||
// - cursorColor: The color to change the cursor to. INVALID_COLOR will revert
|
||||
// it to the legacy inverting behavior.
|
||||
// Return Value:
|
||||
// - true if successful (see DoSrvSetCursorStyle). false otherwise.
|
||||
bool ConhostInternalGetSet::SetCursorColor(const COLORREF cursorColor)
|
||||
{
|
||||
DoSrvSetCursorColor(_io.GetActiveOutputBuffer(), cursorColor);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - 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
|
||||
|
|
|
@ -101,7 +101,6 @@ public:
|
|||
|
||||
bool GetUserDefaultCursorStyle(CursorType& style) override;
|
||||
bool SetCursorStyle(CursorType const style) override;
|
||||
bool SetCursorColor(COLORREF const color) override;
|
||||
|
||||
bool PrivateRefreshWindow() override;
|
||||
|
||||
|
|
|
@ -338,6 +338,18 @@ void Registry::LoadFromRegistry(_In_ PCWSTR const pwszConsoleTitle)
|
|||
_pSettings->SetColorTableEntry(TextColor::DEFAULT_BACKGROUND, dwValue);
|
||||
}
|
||||
|
||||
// Cursor color
|
||||
Status = RegistrySerialization::s_QueryValue(hTitleKey,
|
||||
CONSOLE_REGISTRY_CURSORCOLOR,
|
||||
sizeof(dwValue),
|
||||
REG_DWORD,
|
||||
(PBYTE)&dwValue,
|
||||
nullptr);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
_pSettings->SetColorTableEntry(TextColor::CURSOR_COLOR, dwValue);
|
||||
}
|
||||
|
||||
GetEditKeys(hConsoleKey);
|
||||
|
||||
// Close the registry keys
|
||||
|
|
|
@ -224,8 +224,7 @@ ULONG RenderData::GetCursorPixelWidth() const noexcept
|
|||
COLORREF RenderData::GetCursorColor() const noexcept
|
||||
{
|
||||
const CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
const auto& cursor = gci.GetActiveOutputBuffer().GetTextBuffer().GetCursor();
|
||||
return cursor.GetColor();
|
||||
return gci.GetColorTableEntry(TextColor::CURSOR_COLOR);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
|
|
@ -123,7 +123,6 @@ SCREEN_INFORMATION::~SCREEN_INFORMATION()
|
|||
pScreen->_renderTarget);
|
||||
|
||||
const auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
pScreen->_textBuffer->GetCursor().SetColor(gci.GetCursorColor());
|
||||
pScreen->_textBuffer->GetCursor().SetType(gci.GetCursorType());
|
||||
|
||||
const NTSTATUS status = pScreen->_InitializeOutputStateMachine();
|
||||
|
@ -1630,29 +1629,6 @@ void SCREEN_INFORMATION::SetCursorInformation(const ULONG Size,
|
|||
}
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - This routine sets the cursor color. Also updates the cursor information of
|
||||
// this buffer's main buffer, if this buffer is an alt buffer.
|
||||
// Arguments:
|
||||
// - Color - The new color to set the cursor to
|
||||
// - setMain - If true, propagate change to main buffer as well.
|
||||
// Return Value:
|
||||
// - None
|
||||
void SCREEN_INFORMATION::SetCursorColor(const unsigned int Color, const bool setMain) noexcept
|
||||
{
|
||||
Cursor& cursor = _textBuffer->GetCursor();
|
||||
|
||||
cursor.SetColor(Color);
|
||||
|
||||
// If we're an alt buffer, DON'T propagate this setting up to the main buffer.
|
||||
// We don't want to pollute that buffer with this state,
|
||||
// UNLESS we're getting called from the propsheet, then we DO want to update this.
|
||||
if (_psiMainBuffer && setMain)
|
||||
{
|
||||
_psiMainBuffer->SetCursorColor(Color);
|
||||
}
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - This routine sets the cursor shape both in the data
|
||||
// structures and on the screen. Also updates the cursor information of
|
||||
|
@ -1908,7 +1884,7 @@ const SCREEN_INFORMATION& SCREEN_INFORMATION::GetMainBuffer() const
|
|||
auto& myCursor = GetTextBuffer().GetCursor();
|
||||
auto* const createdBuffer = *ppsiNewScreenBuffer;
|
||||
auto& altCursor = createdBuffer->GetTextBuffer().GetCursor();
|
||||
altCursor.SetStyle(myCursor.GetSize(), myCursor.GetColor(), myCursor.GetType());
|
||||
altCursor.SetStyle(myCursor.GetSize(), myCursor.GetType());
|
||||
altCursor.SetIsVisible(myCursor.IsVisible());
|
||||
altCursor.SetBlinkingAllowed(myCursor.IsBlinkingAllowed());
|
||||
// The new position should match the viewport-relative position of the main buffer.
|
||||
|
@ -2006,7 +1982,7 @@ void SCREEN_INFORMATION::UseMainScreenBuffer()
|
|||
// Copy the alt buffer's cursor style and visibility back to the main buffer.
|
||||
const auto& altCursor = psiAlt->GetTextBuffer().GetCursor();
|
||||
auto& mainCursor = psiMain->GetTextBuffer().GetCursor();
|
||||
mainCursor.SetStyle(altCursor.GetSize(), altCursor.GetColor(), altCursor.GetType());
|
||||
mainCursor.SetStyle(altCursor.GetSize(), altCursor.GetType());
|
||||
mainCursor.SetIsVisible(altCursor.IsVisible());
|
||||
mainCursor.SetBlinkingAllowed(altCursor.IsBlinkingAllowed());
|
||||
|
||||
|
|
|
@ -189,8 +189,6 @@ public:
|
|||
void SetCursorInformation(const ULONG Size,
|
||||
const bool Visible) noexcept;
|
||||
|
||||
void SetCursorColor(const unsigned int Color, const bool setMain = false) noexcept;
|
||||
|
||||
void SetCursorType(const CursorType Type, const bool setMain = false) noexcept;
|
||||
|
||||
void SetCursorDBMode(const bool DoubleCursor);
|
||||
|
|
|
@ -16,7 +16,6 @@ Selection::Selection() :
|
|||
_fSelectionVisible(false),
|
||||
_ulSavedCursorSize(0),
|
||||
_fSavedCursorVisible(false),
|
||||
_savedCursorColor(INVALID_COLOR),
|
||||
_savedCursorType(CursorType::Legacy),
|
||||
_dwSelectionFlags(0),
|
||||
_fLineSelection(true),
|
||||
|
|
|
@ -174,7 +174,6 @@ private:
|
|||
COORD _coordSavedCursorPosition;
|
||||
ULONG _ulSavedCursorSize;
|
||||
bool _fSavedCursorVisible;
|
||||
COLORREF _savedCursorColor;
|
||||
CursorType _savedCursorType;
|
||||
|
||||
#ifdef UNIT_TESTING
|
||||
|
|
|
@ -168,7 +168,6 @@ void Selection::_SaveCursorData(const Cursor& cursor) noexcept
|
|||
_coordSavedCursorPosition = cursor.GetPosition();
|
||||
_ulSavedCursorSize = cursor.GetSize();
|
||||
_fSavedCursorVisible = cursor.IsVisible();
|
||||
_savedCursorColor = cursor.GetColor();
|
||||
_savedCursorType = cursor.GetType();
|
||||
}
|
||||
|
||||
|
@ -182,7 +181,6 @@ void Selection::_RestoreDataToCursor(Cursor& cursor) noexcept
|
|||
{
|
||||
cursor.SetSize(_ulSavedCursorSize);
|
||||
cursor.SetIsVisible(_fSavedCursorVisible);
|
||||
cursor.SetColor(_savedCursorColor);
|
||||
cursor.SetType(_savedCursorType);
|
||||
cursor.SetIsOn(true);
|
||||
cursor.SetPosition(_coordSavedCursorPosition);
|
||||
|
|
|
@ -78,7 +78,6 @@ Settings::Settings() :
|
|||
ZeroMemory((void*)&_FaceName, sizeof(_FaceName));
|
||||
wcscpy_s(_FaceName, DEFAULT_TT_FONT_FACENAME);
|
||||
|
||||
_CursorColor = Cursor::s_InvertCursorColor;
|
||||
_CursorType = CursorType::Legacy;
|
||||
|
||||
gsl::span<COLORREF> tableView = { _colorTable.data(), _colorTable.size() };
|
||||
|
@ -86,6 +85,7 @@ Settings::Settings() :
|
|||
|
||||
_colorTable.at(TextColor::DEFAULT_FOREGROUND) = INVALID_COLOR;
|
||||
_colorTable.at(TextColor::DEFAULT_BACKGROUND) = INVALID_COLOR;
|
||||
_colorTable.at(TextColor::CURSOR_COLOR) = INVALID_COLOR;
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
@ -232,11 +232,11 @@ void Settings::InitFromStateInfo(_In_ PCONSOLE_STATE_INFO pStateInfo)
|
|||
_fCtrlKeyShortcutsDisabled = pStateInfo->fCtrlKeyShortcutsDisabled;
|
||||
_bLineSelection = pStateInfo->fLineSelection;
|
||||
_bWindowAlpha = pStateInfo->bWindowTransparency;
|
||||
_CursorColor = pStateInfo->CursorColor;
|
||||
_CursorType = static_cast<CursorType>(pStateInfo->CursorType);
|
||||
_fInterceptCopyPaste = pStateInfo->InterceptCopyPaste;
|
||||
_colorTable.at(TextColor::DEFAULT_FOREGROUND) = pStateInfo->DefaultForeground;
|
||||
_colorTable.at(TextColor::DEFAULT_BACKGROUND) = pStateInfo->DefaultBackground;
|
||||
_colorTable.at(TextColor::CURSOR_COLOR) = pStateInfo->CursorColor;
|
||||
_TerminalScrolling = pStateInfo->TerminalScrolling;
|
||||
}
|
||||
|
||||
|
@ -277,11 +277,11 @@ CONSOLE_STATE_INFO Settings::CreateConsoleStateInfo() const
|
|||
csi.fCtrlKeyShortcutsDisabled = _fCtrlKeyShortcutsDisabled;
|
||||
csi.fLineSelection = _bLineSelection;
|
||||
csi.bWindowTransparency = _bWindowAlpha;
|
||||
csi.CursorColor = _CursorColor;
|
||||
csi.CursorType = static_cast<unsigned int>(_CursorType);
|
||||
csi.InterceptCopyPaste = _fInterceptCopyPaste;
|
||||
csi.DefaultForeground = _colorTable.at(TextColor::DEFAULT_FOREGROUND);
|
||||
csi.DefaultBackground = _colorTable.at(TextColor::DEFAULT_BACKGROUND);
|
||||
csi.CursorColor = _colorTable.at(TextColor::CURSOR_COLOR);
|
||||
csi.TerminalScrolling = _TerminalScrolling;
|
||||
return csi;
|
||||
}
|
||||
|
@ -335,11 +335,13 @@ void Settings::Validate()
|
|||
|
||||
const auto defaultForeground = _colorTable.at(TextColor::DEFAULT_FOREGROUND);
|
||||
const auto defaultBackground = _colorTable.at(TextColor::DEFAULT_BACKGROUND);
|
||||
const auto cursorColor = _colorTable.at(TextColor::CURSOR_COLOR);
|
||||
|
||||
// If the extended color options are set to invalid values (all the same color), reset them.
|
||||
if (_CursorColor != Cursor::s_InvertCursorColor && _CursorColor == defaultBackground)
|
||||
if (cursorColor != INVALID_COLOR && cursorColor == defaultBackground)
|
||||
{
|
||||
_CursorColor = Cursor::s_InvertCursorColor;
|
||||
// INVALID_COLOR is used to represent "Invert Colors"
|
||||
_colorTable.at(TextColor::CURSOR_COLOR) = INVALID_COLOR;
|
||||
}
|
||||
|
||||
if (defaultForeground != INVALID_COLOR && defaultForeground == defaultBackground)
|
||||
|
@ -769,21 +771,11 @@ COLORREF Settings::GetLegacyColorTableEntry(const size_t index) const
|
|||
return _colorTable.at(TextColor::TransposeLegacyIndex(index));
|
||||
}
|
||||
|
||||
COLORREF Settings::GetCursorColor() const noexcept
|
||||
{
|
||||
return _CursorColor;
|
||||
}
|
||||
|
||||
CursorType Settings::GetCursorType() const noexcept
|
||||
{
|
||||
return _CursorType;
|
||||
}
|
||||
|
||||
void Settings::SetCursorColor(const COLORREF CursorColor) noexcept
|
||||
{
|
||||
_CursorColor = CursorColor;
|
||||
}
|
||||
|
||||
void Settings::SetCursorType(const CursorType cursorType) noexcept
|
||||
{
|
||||
_CursorType = cursorType;
|
||||
|
|
|
@ -177,10 +177,7 @@ public:
|
|||
void SetLegacyColorTableEntry(const size_t index, const COLORREF ColorValue);
|
||||
COLORREF GetLegacyColorTableEntry(const size_t index) const;
|
||||
|
||||
COLORREF GetCursorColor() const noexcept;
|
||||
CursorType GetCursorType() const noexcept;
|
||||
|
||||
void SetCursorColor(const COLORREF CursorColor) noexcept;
|
||||
void SetCursorType(const CursorType cursorType) noexcept;
|
||||
|
||||
bool GetInterceptCopyPaste() const noexcept;
|
||||
|
@ -248,8 +245,6 @@ private:
|
|||
bool _fUseWindowSizePixels;
|
||||
COORD _dwWindowSizePixels;
|
||||
|
||||
// Technically a COLORREF, but using INVALID_COLOR as "Invert Colors"
|
||||
unsigned int _CursorColor;
|
||||
CursorType _CursorType;
|
||||
|
||||
bool _fInterceptCopyPaste;
|
||||
|
|
|
@ -360,12 +360,11 @@ void ScreenBufferTests::AlternateBufferCursorInheritanceTest()
|
|||
auto mainCursorPos = COORD{ 3, 5 };
|
||||
auto mainCursorVisible = false;
|
||||
auto mainCursorSize = 33u;
|
||||
auto mainCursorColor = RGB(1, 2, 3);
|
||||
auto mainCursorType = CursorType::DoubleUnderscore;
|
||||
auto mainCursorBlinking = false;
|
||||
mainCursor.SetPosition(mainCursorPos);
|
||||
mainCursor.SetIsVisible(mainCursorVisible);
|
||||
mainCursor.SetStyle(mainCursorSize, mainCursorColor, mainCursorType);
|
||||
mainCursor.SetStyle(mainCursorSize, mainCursorType);
|
||||
mainCursor.SetBlinkingAllowed(mainCursorBlinking);
|
||||
|
||||
Log::Comment(L"Switch to the alternate buffer.");
|
||||
|
@ -380,7 +379,6 @@ void ScreenBufferTests::AlternateBufferCursorInheritanceTest()
|
|||
VERIFY_ARE_EQUAL(mainCursorVisible, altCursor.IsVisible());
|
||||
Log::Comment(L"Confirm the cursor style is inherited from the main buffer.");
|
||||
VERIFY_ARE_EQUAL(mainCursorSize, altCursor.GetSize());
|
||||
VERIFY_ARE_EQUAL(mainCursorColor, altCursor.GetColor());
|
||||
VERIFY_ARE_EQUAL(mainCursorType, altCursor.GetType());
|
||||
VERIFY_ARE_EQUAL(mainCursorBlinking, altCursor.IsBlinkingAllowed());
|
||||
|
||||
|
@ -388,12 +386,11 @@ void ScreenBufferTests::AlternateBufferCursorInheritanceTest()
|
|||
auto altCursorPos = COORD{ 5, 3 };
|
||||
auto altCursorVisible = true;
|
||||
auto altCursorSize = 66u;
|
||||
auto altCursorColor = RGB(3, 2, 1);
|
||||
auto altCursorType = CursorType::EmptyBox;
|
||||
auto altCursorBlinking = true;
|
||||
altCursor.SetPosition(altCursorPos);
|
||||
altCursor.SetIsVisible(altCursorVisible);
|
||||
altCursor.SetStyle(altCursorSize, altCursorColor, altCursorType);
|
||||
altCursor.SetStyle(altCursorSize, altCursorType);
|
||||
altCursor.SetBlinkingAllowed(altCursorBlinking);
|
||||
|
||||
Log::Comment(L"Switch back to the main buffer.");
|
||||
|
@ -407,7 +404,6 @@ void ScreenBufferTests::AlternateBufferCursorInheritanceTest()
|
|||
VERIFY_ARE_EQUAL(altCursorVisible, mainCursor.IsVisible());
|
||||
Log::Comment(L"Confirm the cursor style is inherited from the alt buffer.");
|
||||
VERIFY_ARE_EQUAL(altCursorSize, mainCursor.GetSize());
|
||||
VERIFY_ARE_EQUAL(altCursorColor, mainCursor.GetColor());
|
||||
VERIFY_ARE_EQUAL(altCursorType, mainCursor.GetType());
|
||||
VERIFY_ARE_EQUAL(altCursorBlinking, mainCursor.IsBlinkingAllowed());
|
||||
}
|
||||
|
@ -1743,7 +1739,6 @@ void ScreenBufferTests::ResizeCursorUnchanged()
|
|||
// Get initial cursor values
|
||||
const CursorType initialType = initialCursor.GetType();
|
||||
const auto initialSize = initialCursor.GetSize();
|
||||
const COLORREF initialColor = initialCursor.GetColor();
|
||||
|
||||
// set our wrap mode accordingly - ResizeScreenBuffer will be smart enough
|
||||
// to call the appropriate implementation
|
||||
|
@ -1758,10 +1753,8 @@ void ScreenBufferTests::ResizeCursorUnchanged()
|
|||
const auto& finalCursor = si.GetTextBuffer().GetCursor();
|
||||
const CursorType finalType = finalCursor.GetType();
|
||||
const auto finalSize = finalCursor.GetSize();
|
||||
const COLORREF finalColor = finalCursor.GetColor();
|
||||
|
||||
VERIFY_ARE_EQUAL(initialType, finalType);
|
||||
VERIFY_ARE_EQUAL(initialColor, finalColor);
|
||||
VERIFY_ARE_EQUAL(initialSize, finalSize);
|
||||
}
|
||||
|
||||
|
@ -2124,7 +2117,6 @@ void ScreenBufferTests::TestAltBufferCursorState()
|
|||
// Validate that the cursor state was copied appropriately into the
|
||||
// alternate buffer
|
||||
VERIFY_ARE_EQUAL(mainCursor.GetSize(), altCursor.GetSize());
|
||||
VERIFY_ARE_EQUAL(mainCursor.GetColor(), altCursor.GetColor());
|
||||
VERIFY_ARE_EQUAL(mainCursor.GetType(), altCursor.GetType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -315,7 +315,7 @@ void Menu::s_ShowPropertiesDialog(HWND const hwnd, BOOL const Defaults)
|
|||
|
||||
const Cursor& cursor = ScreenInfo.GetTextBuffer().GetCursor();
|
||||
pStateInfo->CursorSize = cursor.GetSize();
|
||||
pStateInfo->CursorColor = cursor.GetColor();
|
||||
pStateInfo->CursorColor = gci.GetColorTableEntry(TextColor::CURSOR_COLOR);
|
||||
pStateInfo->CursorType = static_cast<unsigned int>(cursor.GetType());
|
||||
|
||||
// Retrieve small icon for use in displaying the dialog
|
||||
|
@ -461,13 +461,12 @@ void Menu::s_PropertiesUpdate(PCONSOLE_STATE_INFO pStateInfo)
|
|||
|
||||
// Set the cursor properties in the Settings
|
||||
const auto cursorType = static_cast<CursorType>(pStateInfo->CursorType);
|
||||
gci.SetCursorColor(pStateInfo->CursorColor);
|
||||
gci.SetCursorType(cursorType);
|
||||
gci.SetColorTableEntry(TextColor::CURSOR_COLOR, pStateInfo->CursorColor);
|
||||
|
||||
// Then also apply them to the buffer's cursor
|
||||
ScreenInfo.SetCursorInformation(pStateInfo->CursorSize,
|
||||
ScreenInfo.GetTextBuffer().GetCursor().IsVisible());
|
||||
ScreenInfo.SetCursorColor(pStateInfo->CursorColor, true);
|
||||
ScreenInfo.SetCursorType(cursorType, true);
|
||||
|
||||
gci.SetTerminalScrolling(pStateInfo->TerminalScrolling);
|
||||
|
|
|
@ -57,7 +57,6 @@ const RegistrySerialization::_RegPropertyMap RegistrySerialization::s_PropertyMa
|
|||
{ _RegPropertyType::Boolean, CONSOLE_REGISTRY_TRIMZEROHEADINGS, SET_FIELD_AND_SIZE(_fTrimLeadingZeros) },
|
||||
{ _RegPropertyType::Boolean, CONSOLE_REGISTRY_ENABLE_COLOR_SELECTION, SET_FIELD_AND_SIZE(_fEnableColorSelection) },
|
||||
{ _RegPropertyType::Coordinate, CONSOLE_REGISTRY_WINDOWPOS, SET_FIELD_AND_SIZE(_dwWindowOrigin) },
|
||||
{ _RegPropertyType::Dword, CONSOLE_REGISTRY_CURSORCOLOR, SET_FIELD_AND_SIZE(_CursorColor) },
|
||||
{ _RegPropertyType::Dword, CONSOLE_REGISTRY_CURSORTYPE, SET_FIELD_AND_SIZE(_CursorType) },
|
||||
{ _RegPropertyType::Boolean, CONSOLE_REGISTRY_INTERCEPTCOPYPASTE, SET_FIELD_AND_SIZE(_fInterceptCopyPaste) },
|
||||
{ _RegPropertyType::Boolean, CONSOLE_REGISTRY_TERMINALSCROLLING, SET_FIELD_AND_SIZE(_TerminalScrolling) },
|
||||
|
|
|
@ -2250,7 +2250,7 @@ bool AdaptDispatch::SetCursorColor(const COLORREF cursorColor)
|
|||
return false;
|
||||
}
|
||||
|
||||
return _pConApi->SetCursorColor(cursorColor);
|
||||
return _pConApi->SetColorTableEntry(TextColor::CURSOR_COLOR, cursorColor);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
|
|
|
@ -72,7 +72,6 @@ namespace Microsoft::Console::VirtualTerminal
|
|||
virtual bool PrivateClearBuffer() = 0;
|
||||
virtual bool GetUserDefaultCursorStyle(CursorType& style) = 0;
|
||||
virtual bool SetCursorStyle(const CursorType style) = 0;
|
||||
virtual bool SetCursorColor(const COLORREF color) = 0;
|
||||
virtual bool PrivateWriteConsoleControlInput(const KeyEvent key) = 0;
|
||||
virtual bool PrivateRefreshWindow() = 0;
|
||||
|
||||
|
|
|
@ -370,16 +370,6 @@ public:
|
|||
return _setCursorStyleResult;
|
||||
}
|
||||
|
||||
bool SetCursorColor(const COLORREF cursorColor) override
|
||||
{
|
||||
Log::Comment(L"SetCursorColor MOCK called...");
|
||||
if (_setCursorColorResult)
|
||||
{
|
||||
VERIFY_ARE_EQUAL(_expectedCursorColor, cursorColor);
|
||||
}
|
||||
return _setCursorColorResult;
|
||||
}
|
||||
|
||||
bool PrivateRefreshWindow() override
|
||||
{
|
||||
Log::Comment(L"PrivateRefreshWindow MOCK called...");
|
||||
|
@ -717,8 +707,6 @@ public:
|
|||
std::wstring_view _expectedWindowTitle{};
|
||||
bool _setCursorStyleResult = false;
|
||||
CursorType _expectedCursorStyle;
|
||||
bool _setCursorColorResult = false;
|
||||
COLORREF _expectedCursorColor = 0;
|
||||
bool _setConsoleOutputCPResult = false;
|
||||
bool _getConsoleOutputCPResult = false;
|
||||
bool _moveToBottomResult = false;
|
||||
|
|
Loading…
Reference in a new issue