Skip to content

Commit

Permalink
Implement SetCursorColor in Terminal (#7123)
Browse files Browse the repository at this point in the history
This was never hooked up to the TerminalCore implementation.

Closes #7102

(cherry picked from commit 2f5ba94)
  • Loading branch information
PankajBhojwani authored and DHowett committed Jul 31, 2020
1 parent 6084670 commit 288436a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/ITerminalApi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace Microsoft::Terminal::Core
virtual bool SetColorTableEntry(const size_t tableIndex, const DWORD 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 SetDefaultForeground(const DWORD color) noexcept = 0;
virtual bool SetDefaultBackground(const DWORD color) noexcept = 0;
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Microsoft::Terminal::Core::Terminal final :
bool SetWindowTitle(std::wstring_view title) 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 SetDefaultForeground(const COLORREF color) noexcept override;
bool SetDefaultBackground(const COLORREF color) noexcept override;

Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalCore/TerminalApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ COORD Terminal::GetCursorPosition() noexcept
return newPos;
}

bool Terminal::SetCursorColor(const COLORREF color) noexcept
try
{
_buffer->GetCursor().SetColor(color);
return true;
}
CATCH_LOG_RETURN_FALSE()

// Method Description:
// - Moves the cursor down one line, and possibly also to the leftmost column.
// Arguments:
Expand Down
7 changes: 7 additions & 0 deletions src/cascadia/TerminalCore/TerminalDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ try
}
CATCH_LOG_RETURN_FALSE()

bool TerminalDispatch::SetCursorColor(const DWORD color) noexcept
try
{
return _terminalApi.SetCursorColor(color);
}
CATCH_LOG_RETURN_FALSE()

bool TerminalDispatch::SetClipboard(std::wstring_view content) noexcept
try
{
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalCore/TerminalDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TerminalDispatch : public Microsoft::Console::VirtualTerminal::TermDispatc

bool SetColorTableEntry(const size_t tableIndex, const DWORD color) noexcept override;
bool SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle) noexcept override;
bool SetCursorColor(const DWORD color) noexcept override;

bool SetClipboard(std::wstring_view content) noexcept override;

Expand Down

0 comments on commit 288436a

Please sign in to comment.