Repository: microsoft/terminal
File: src/cascadia/TerminalControl/ControlCore.cpp (C++)

Code before:
    {
        const auto fontSize = GetFont().GetSize();
        return {
            ::base::saturated_cast<float>(fontSize.X),
            ::base::saturated_cast<float>(fontSize.Y)
        };
    }
    winrt::hstring ControlCore::FontFaceName() const noexcept
    {
        return winrt::hstring{ GetFont().GetFaceName() };
    }

    uint16_t ControlCore::FontWeight() const noexcept
    {
        return static_cast<uint16_t>(GetFont().GetWeight());
    }

    til::size ControlCore::FontSizeInDips() const
    {
        const til::size fontSize{ GetFont().GetSize() };
        return fontSize.scale(til::math::rounding, 1.0f / ::base::saturated_cast<float>(_compositionScale));
    }

    TerminalConnection::ConnectionState ControlCore::ConnectionState() const
    {
        return _connection.State();
    }

    hstring ControlCore::Title()
    {
        return hstring{ _terminal->GetConsoleTitle() };
    }

    hstring ControlCore::WorkingDirectory() const
    {
        return hstring{ _terminal->GetWorkingDirectory() };
    }

    bool ControlCore::BracketedPasteEnabled() const noexcept
    {
        return _terminal->IsXtermBracketedPasteModeEnabled();
    }

    Windows::Foundation::IReference<winrt::Windows::UI::Color> ControlCore::TabColor() noexcept
    {
        auto coreColor = _terminal->GetTabColor();
        return coreColor.has_value() ? Windows::Foundation::IReference<winrt::Windows::UI::Color>(til::color{ coreColor.value() }) :
                                       nullptr;
    }

    til::color ControlCore::BackgroundColor() const

Review comment (bug):
Prefer `NotConnected` here -- technically (poorly documented) connections should only move one direction  (NotConn->Connecting->Connected->Closing->Closed or ...->Failed (at any point))

Code after:
    {
        const auto fontSize = GetFont().GetSize();
        return {
            ::base::saturated_cast<float>(fontSize.X),
            ::base::saturated_cast<float>(fontSize.Y)
        };
    }
    winrt::hstring ControlCore::FontFaceName() const noexcept
    {
        return winrt::hstring{ GetFont().GetFaceName() };
    }

    uint16_t ControlCore::FontWeight() const noexcept
    {
        return static_cast<uint16_t>(GetFont().GetWeight());
    }

    til::size ControlCore::FontSizeInDips() const
    {
        const til::size fontSize{ GetFont().GetSize() };
        return fontSize.scale(til::math::rounding, 1.0f / ::base::saturated_cast<float>(_compositionScale));
    }

    TerminalConnection::ConnectionState ControlCore::ConnectionState() const
    {
        return _connection ? _connection.State() : TerminalConnection::ConnectionState::Closed;
    }

    hstring ControlCore::Title()
    {
        return hstring{ _terminal->GetConsoleTitle() };
    }

    hstring ControlCore::WorkingDirectory() const
    {
        return hstring{ _terminal->GetWorkingDirectory() };
    }

    bool ControlCore::BracketedPasteEnabled() const noexcept
    {
        return _terminal->IsXtermBracketedPasteModeEnabled();
    }

    Windows::Foundation::IReference<winrt::Windows::UI::Color> ControlCore::TabColor() noexcept
    {
        auto coreColor = _terminal->GetTabColor();
        return coreColor.has_value() ? Windows::Foundation::IReference<winrt::Windows::UI::Color>(til::color{ coreColor.value() }) :
                                       nullptr;
    }

    til::color ControlCore::BackgroundColor() const