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

Code before:
        {
            return RS_(L"TermControl_NoMatch");
        }
        std::wstringstream ss;

        if (currentMatch < 0 || currentMatch > (MaximumTotalResultsToShowInStatus - 1))
        {
            ss << CurrentIndexTooHighStatus;
        }
        else
        {
            ss << currentMatch + 1;
        }

        ss << StatusDelimiter;

        if (totalMatches > MaximumTotalResultsToShowInStatus)
        {
            ss << TotalResultsTooHighStatus;
        }
        else
        {
            ss << totalMatches;
        }

        return ss.str().data();
    }

    // Method Description:
    // - Helper method to measure the width of the text block given the text and the font size
    // Arguments:
    // - text: the text to measure
    // - fontSize: the size of the font to measure
    // Return Value:
    // - the size in pixels
    double SearchBoxControl::_TextWidth(winrt::hstring text, double fontSize)
    {
        winrt::Windows::UI::Xaml::Controls::TextBlock t;
        t.FontSize(fontSize);
        t.Text(text);
        t.Measure({ FLT_MAX, FLT_MAX });
        return t.ActualWidth();
    }

    // Method Description:
    // - This method tries to predict the maximal size of the status box
    // by measuring different possible statuses
    // Return Value:
    // - the size in pixels
    double SearchBoxControl::_GetStatusMaxWidth()
    {

Review comment (suggestion):
nit: Don't use `.data()` to create a `hstring`. Just construct it explicitly with `winrt::hstring{ ss.str() }`. But I would still prefer if this used `fmt` instead, for consistency and comfort. 😅 It seems like this can be done via
```cpp
fmt::format(FMT_COMPILE(L"{}/{}", arg1, arg2);
```
where arg1/2 are the results of the two if conditions.

Code after:
        if (totalMatches < 0)
        {
            return RS_(L"TermControl_Searching");
        }

        if (totalMatches == 0)
        {
            return RS_(L"TermControl_NoMatch");
        }

        std::wstring currentString;
        std::wstring totalString;

        if (currentMatch < 0 || currentMatch > (MaximumTotalResultsToShowInStatus - 1))
        {
            currentString = CurrentIndexTooHighStatus;
        }
        else
        {
            currentString = fmt::format(L"{}", currentMatch + 1);
        }

        if (totalMatches > MaximumTotalResultsToShowInStatus)
        {
            totalString = TotalResultsTooHighStatus;
        }
        else
        {
            totalString = fmt::format(L"{}", totalMatches);
        }

        return winrt::hstring{ fmt::format(RS_(L"TermControl_NumResults").c_str(), currentString, totalString) };
    }

    // Method Description:
    // - Helper method to measure the width of the text block given the text and the font size
    // Arguments:
    // - text: the text to measure
    // - fontSize: the size of the font to measure
    // Return Value:
    // - the size in pixels
    double SearchBoxControl::_TextWidth(winrt::hstring text, double fontSize)
    {
        winrt::Windows::UI::Xaml::Controls::TextBlock t;
        t.FontSize(fontSize);
        t.Text(text);
        t.Measure({ FLT_MAX, FLT_MAX });
        return t.ActualWidth();
    }

    // Method Description: