Repository: microsoft/terminal
File: src/host/screenInfo.hpp (C++)

Code before:
    bool IsActiveScreenBuffer() const;

    const Microsoft::Console::VirtualTerminal::StateMachine& GetStateMachine() const;
    Microsoft::Console::VirtualTerminal::StateMachine& GetStateMachine();

    void SetCursorInformation(const ULONG Size,
                              const bool Visible) noexcept;

    void SetCursorType(const CursorType Type, const bool setMain = false) noexcept;

    void SetCursorDBMode(const bool DoubleCursor);
    [[nodiscard]] NTSTATUS SetCursorPosition(til::point Position);

    [[nodiscard]] NTSTATUS UseAlternateScreenBuffer(const TextAttribute& initAttributes);
    void UseMainScreenBuffer();

    SCREEN_INFORMATION& GetMainBuffer();
    const SCREEN_INFORMATION& GetMainBuffer() const;
    const SCREEN_INFORMATION* GetAltBuffer() const noexcept;
    SCREEN_INFORMATION& GetActiveBuffer();
    const SCREEN_INFORMATION& GetActiveBuffer() const;

    const TextAttribute& GetAttributes() const noexcept;
    const TextAttribute& GetPopupAttributes() const noexcept;

    void SetAttributes(const TextAttribute& attributes);
    void SetPopupAttributes(const TextAttribute& popupAttributes);
    void SetDefaultAttributes(const TextAttribute& attributes,
                              const TextAttribute& popupAttributes);

    void UpdateBottom();

    FontInfo& GetCurrentFont() noexcept;
    const FontInfo& GetCurrentFont() const noexcept;

    FontInfoDesired& GetDesiredFont() noexcept;
    const FontInfoDesired& GetDesiredFont() const noexcept;

    [[nodiscard]] NTSTATUS ResizeWithReflow(const til::size coordnewScreenSize);
    [[nodiscard]] NTSTATUS ResizeTraditional(const til::size coordNewScreenSize);

    bool ConptyCursorPositionMayBeWrong() const noexcept;
    void SetConptyCursorPositionMayBeWrong() noexcept;
    void ResetConptyCursorPositionMayBeWrong() noexcept;
    void WaitForConptyCursorPositionToBeSynchronized() noexcept;

private:
    SCREEN_INFORMATION(_In_ Microsoft::Console::Interactivity::IWindowMetrics* pMetrics,
                       const TextAttribute popupAttributes,
                       const FontInfo fontInfo);


Review comment (bug):
hey, there's nothing wrong with `type name{ value }` syntax :(

Code after:
    [[nodiscard]] HRESULT _AdjustScreenBuffer(const til::rect* clientNew);
    [[nodiscard]] NTSTATUS _CreateAltBuffer(const TextAttribute& initAttributes, SCREEN_INFORMATION** newScreenBuffer);
    bool _IsAltBuffer() const;
    bool _IsInPtyMode() const;
    bool _IsInVTMode() const;

    // Cursor
    void _makeCursorVisible();

    // Rendering / Viewport
    void _CalculateViewportSize(const til::rect* clientArea, til::size* size);
    void _AdjustViewportSize(const til::rect* clientNew, const til::rect* clientOld, const til::size* size);
    void _InternalSetViewportSize(const til::size* size, bool resizeFromTop, bool resizeFromLeft);

    // Windowing
    static void s_CalculateScrollbarVisibility(const til::rect* clientArea, const til::size* bufferSize, const til::size* fontSize, bool* horizontalVisible, bool* verticalVisible);
    static void _handleDeferredResize(SCREEN_INFORMATION& siMain);

    Microsoft::Console::Interactivity::IWindowMetrics* _pConsoleWindowMetrics;
    std::unique_ptr<TextBuffer> _textBuffer{ nullptr };
    ConhostInternalGetSet _api{ *this };
    std::shared_ptr<Microsoft::Console::VirtualTerminal::StateMachine> _stateMachine;
    // 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 = 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 = false;
    TextAttribute _PopupAttributes;
    FontInfo _currentFont;
    FontInfoDesired _desiredFont;
    // 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 = 0;
    std::optional<til::size> _deferredPtyResize;
    std::atomic<bool> _conptyCursorPositionMayBeWrong = false;

#ifdef UNIT_TESTING
    friend class TextBufferIteratorTests;
    friend class ScreenBufferTests;
    friend class CommonState;
#endif
};