Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp (C++)

Code before:
        _LaunchModeList.RemoveAt(6); // fullscreenFocus
        _LaunchModeList.RemoveAt(3); // maximizedFullscreen
        INITIALIZE_BINDABLE_ENUM_SETTING(WindowingBehavior, WindowingMode, WindowingMode, L"Globals_WindowingBehavior", L"Content");

        // Add a property changed handler to our own property changed event.
        // This propagates changes from the settings model to anybody listening to our
        // unique view model members.
        PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
            const auto viewModelProperty{ args.PropertyName() };
            if (viewModelProperty == L"CenterOnLaunch")
            {
                _NotifyChanges(L"LaunchParametersCurrentValue");
            }
        });
    }

    winrt::hstring LaunchViewModel::LaunchParametersCurrentValue()
    {
        // todo: get all the current values and combine them into a string
        const auto launchModeString = CurrentLaunchMode().as<EnumEntry>()->EnumName();
        const auto centerOnLaunchString = CenterOnLaunch() ? RS_(L"Globals_CenterOnLaunchOn") : RS_(L"Globals_CenterOnLaunchOff");

        winrt::hstring result;

        if (UseDefaultLaunchPosition())
        {
            result = fmt::format(L"{}, {}, {}", launchModeString, RS_(L"Globals_LaunchModeDefault/Content"), centerOnLaunchString);
        }
        else
        {
            std::wstring xPosString;
            std::wstring yPosString;
            if (!isnan(InitialPosX()))
            {
                xPosString = std::to_wstring(gsl::narrow_cast<int>(InitialPosX()));
            }
            else
            {
                xPosString = RS_(L"Globals_LaunchModeDefault/Content");
            }
            if (!isnan(InitialPosY()))
            {
                yPosString = std::to_wstring(gsl::narrow_cast<int>(InitialPosY()));
            }
            else
            {
                yPosString = RS_(L"Globals_LaunchModeDefault/Content");
            }
            result = fmt::format(L"{}, ({},{}), {}", launchModeString, xPosString, yPosString, centerOnLaunchString);
        }
        return result;

Review comment (suggestion):
For the record, I don't like that you can get `Default, Default, Off` here. If I was just given that string, idk what it really means without opening the expander. _THAT SAID_, I don't think there's any way to fix that problem, and I'd rather have it than not have it.

If anybody comes along and thinks of a better string to have here, we can change it.

Code after:
        _LaunchModeList.RemoveAt(6); // fullscreenFocus
        _LaunchModeList.RemoveAt(3); // maximizedFullscreen
        INITIALIZE_BINDABLE_ENUM_SETTING(WindowingBehavior, WindowingMode, WindowingMode, L"Globals_WindowingBehavior", L"Content");

        // Add a property changed handler to our own property changed event.
        // This propagates changes from the settings model to anybody listening to our
        // unique view model members.
        PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
            const auto viewModelProperty{ args.PropertyName() };
            if (viewModelProperty == L"CenterOnLaunch")
            {
                _NotifyChanges(L"LaunchParametersCurrentValue");
            }
        });
    }

    winrt::hstring LaunchViewModel::LaunchParametersCurrentValue()
    {
        const auto launchModeString = CurrentLaunchMode().as<EnumEntry>()->EnumName();
        const auto centerOnLaunchString = CenterOnLaunch() ? RS_(L"Globals_CenterOnLaunchOn") : RS_(L"Globals_CenterOnLaunchOff");

        winrt::hstring result;

        if (UseDefaultLaunchPosition())
        {
            result = fmt::format(L"{}, {}, {}", launchModeString, RS_(L"Globals_LaunchModeDefault/Content"), centerOnLaunchString);
        }
        else
        {
            const std::wstring xPosString = isnan(InitialPosX()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosX()));
            const std::wstring yPosString = isnan(InitialPosY()) ? RS_(L"Globals_LaunchModeDefault/Content").c_str() : std::to_wstring(gsl::narrow_cast<int>(InitialPosY()));
            result = fmt::format(L"{}, ({},{}), {}", launchModeString, xPosString, yPosString, centerOnLaunchString);
        }
        return result;
    }

    double LaunchViewModel::InitialPosX()
    {
        const auto x = _Settings.GlobalSettings().InitialPosition().X;
        // If there's no value here, return NAN - XAML will ignore it and
        // put the placeholder text in the box instead
        const auto xCoord = x.try_as<int64_t>();
        return xCoord.has_value() ? gsl::narrow_cast<double>(xCoord.value()) : NAN;
    }

    double LaunchViewModel::InitialPosY()
    {
        const auto y = _Settings.GlobalSettings().InitialPosition().Y;
        // If there's no value here, return NAN - XAML will ignore it and
        // put the placeholder text in the box instead
        const auto yCoord = y.try_as<int64_t>();