Repository: microsoft/terminal
File: src/cascadia/TerminalApp/AppActionHandlers.cpp (C++)

Code before:
        if (args)
        {
            if (const auto& realArgs = args.ActionArgs().try_as<AdjustOpacityArgs>())
            {
                const auto res = _ApplyToActiveControls([&](auto& control) {
                    control.AdjustOpacity(realArgs.Opacity() / 100.0f, realArgs.Relative());
                });
                args.Handled(res);
            }
        }
    }

    void TerminalPage::_HandleSelectAll(const IInspectable& sender,
                                        const ActionEventArgs& args)
    {
        if (const auto& control{ _senderOrActiveControl(sender) })
        {
            control.SelectAll();
            args.Handled(true);
        }
    }

    void TerminalPage::_HandleSaveTask(const IInspectable& /*sender*/,
                                       const ActionEventArgs& args)
    {
        if (Feature_SaveTask::IsEnabled())
        {
            if (args)
            {
                if (const auto& realArgs = args.ActionArgs().try_as<SaveTaskArgs>())
                {
                    if (realArgs.Commandline().empty())
                    {
                        if (const auto termControl{ _GetActiveControl() })
                        {
                            if (termControl.HasSelection())
                            {
                                const auto selections{ termControl.SelectedText(true) };
                                const auto selection = std::accumulate(selections.begin(), selections.end(), std::wstring());
                                realArgs.Commandline(selection);
                            }
                        }
                    }

                    try
                    {
                        winrt::Microsoft::Terminal::Control::KeyChord keyChord = nullptr;
                        if (!realArgs.KeyChord().empty())
                        {
                            keyChord = KeyChordSerialization::FromString(winrt::to_hstring(realArgs.KeyChord()));
                        }

Review comment (suggestion):
Oh also:
```suggestion
        if constexpr (Feature_SaveTask::IsEnabled())
```

Code after:
        if (args)
        {
            if (const auto& realArgs = args.ActionArgs().try_as<AdjustOpacityArgs>())
            {
                const auto res = _ApplyToActiveControls([&](auto& control) {
                    control.AdjustOpacity(realArgs.Opacity() / 100.0f, realArgs.Relative());
                });
                args.Handled(res);
            }
        }
    }

    void TerminalPage::_HandleSelectAll(const IInspectable& sender,
                                        const ActionEventArgs& args)
    {
        if (const auto& control{ _senderOrActiveControl(sender) })
        {
            control.SelectAll();
            args.Handled(true);
        }
    }

    void TerminalPage::_HandleSaveSnippet(const IInspectable& /*sender*/,
                                          const ActionEventArgs& args)
    {
        if constexpr (!Feature_SaveSnippet::IsEnabled())
        {
            return;
        }

        if (args)
        {
            if (const auto& realArgs = args.ActionArgs().try_as<SaveSnippetArgs>())
            {
                auto commandLine = realArgs.Commandline();
                if (commandLine.empty())
                {
                    if (const auto termControl{ _GetActiveControl() })
                    {
                        if (termControl.HasSelection())
                        {
                            const auto selections{ termControl.SelectedText(true) };
                            const auto selection = std::accumulate(selections.begin(), selections.end(), std::wstring());
                            commandLine = selection;
                        }
                    }
                }

                if (commandLine.empty())
                {
                    ActionSaveFailed(L"CommandLine is Required");