Refactor SCREEN_INFORMATION to use in-class initializers (#19645)

Related to #962
This commit is contained in:
Suriya R V 2025-12-16 19:11:07 +05:30 committed by GitHub
parent 20cfb157f7
commit fecd9087eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 30 deletions

View File

@ -22,23 +22,9 @@ SCREEN_INFORMATION::SCREEN_INFORMATION(
_In_ IWindowMetrics* pMetrics,
const TextAttribute popupAttributes,
const FontInfo fontInfo) :
OutputMode{ ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT },
WheelDelta{ 0 },
HWheelDelta{ 0 },
_textBuffer{ nullptr },
Next{ nullptr },
WriteConsoleDbcsLeadByte{ 0, 0 },
FillOutDbcsLeadChar{ 0 },
ScrollScale{ 1ul },
_pConsoleWindowMetrics{ pMetrics },
_api{ *this },
_stateMachine{ nullptr },
_viewport(Viewport::Empty()),
_psiAlternateBuffer{ nullptr },
_psiMainBuffer{ nullptr },
_fAltWindowChanged{ false },
_PopupAttributes{ popupAttributes },
_virtualBottom{ 0 },
_currentFont{ fontInfo },
_desiredFont{ fontInfo }
{

View File

@ -166,20 +166,20 @@ public:
InputBuffer* const GetActiveInputBuffer() const override;
#pragma endregion
DWORD OutputMode;
DWORD OutputMode{ ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT };
short WheelDelta;
short HWheelDelta;
short WheelDelta{ 0 };
short HWheelDelta{ 0 };
private:
std::unique_ptr<TextBuffer> _textBuffer;
std::unique_ptr<TextBuffer> _textBuffer{ nullptr };
public:
SCREEN_INFORMATION* Next;
BYTE WriteConsoleDbcsLeadByte[2];
BYTE FillOutDbcsLeadChar;
SCREEN_INFORMATION* Next{ nullptr };
BYTE WriteConsoleDbcsLeadByte[2]{ 0, 0 };
BYTE FillOutDbcsLeadChar{ 0 };
UINT ScrollScale;
UINT ScrollScale{ 1u };
bool IsActiveScreenBuffer() const;
@ -259,20 +259,20 @@ private:
bool _IsInPtyMode() const;
bool _IsInVTMode() const;
ConhostInternalGetSet _api;
ConhostInternalGetSet _api{ *this };
std::shared_ptr<Microsoft::Console::VirtualTerminal::StateMachine> _stateMachine;
std::shared_ptr<Microsoft::Console::VirtualTerminal::StateMachine> _stateMachine{ nullptr };
// Specifies which coordinates of the screen buffer are visible in the
// window client (the "viewport" into the buffer)
Microsoft::Console::Types::Viewport _viewport;
SCREEN_INFORMATION* _psiAlternateBuffer; // The VT "Alternate" screen buffer.
SCREEN_INFORMATION* _psiMainBuffer; // A pointer to the main buffer, if this is the alternate buffer.
SCREEN_INFORMATION* _psiAlternateBuffer{ nullptr }; // The VT "Alternate" screen buffer.
SCREEN_INFORMATION* _psiMainBuffer{ nullptr }; // A pointer to the main buffer, if this is the alternate buffer.
til::rect _rcAltSavedClientNew;
til::rect _rcAltSavedClientOld;
bool _fAltWindowChanged;
til::rect _rcAltSavedClientNew{};
til::rect _rcAltSavedClientOld{};
bool _fAltWindowChanged{ false };
TextAttribute _PopupAttributes;
@ -282,7 +282,7 @@ private:
// Tracks the last virtual position the viewport was at. This is not
// affected by the user scrolling the viewport, only when API calls cause
// the viewport to move (SetBufferInfo, WriteConsole, etc)
til::CoordType _virtualBottom;
til::CoordType _virtualBottom{ 0 };
std::optional<til::size> _deferredPtyResize{ std::nullopt };
std::atomic<bool> _conptyCursorPositionMayBeWrong = false;