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

Code before:
            control.AdjustOpacity(args.Opacity() / 100.0f, args.Relative());

            if (backup)
            {
                _restorePreviewFuncs.emplace_back([=]() {
                    // On dismiss:
                    // Don't adjust relatively, just set outright.
                    control.AdjustOpacity(originalOpacity, false);
                });
            }
        });
    }

    void TerminalPage::_PreviewSendInput(const Settings::Model::SendInputArgs& args)
    {
        const auto backup = _restorePreviewFuncs.empty();

        _ApplyToActiveControls([&](const auto& control) {
            const auto& str{ args.Input() };
            control.PreviewInput(str);

            if (backup)
            {
                _restorePreviewFuncs.emplace_back([=]() {
                    // On dismiss:
                    control.PreviewInput(L"");
                });
            }
        });
    }

    void TerminalPage::_PreviewAction(const Settings::Model::ActionAndArgs& args)
    {
        switch (args.Action())
        {
        case ShortcutAction::SetColorScheme:
            _PreviewColorScheme(args.Args().try_as<SetColorSchemeArgs>());
            break;
        case ShortcutAction::AdjustOpacity:
            _PreviewAdjustOpacity(args.Args().try_as<AdjustOpacityArgs>());
            break;
        case ShortcutAction::SendInput:
            _PreviewSendInput(args.Args().try_as<SendInputArgs>());
            break;
        }

        // GH#9818 Other ideas for actions that could be preview-able:
        // * Set Font size
        // * Set acrylic true/false/opacity?
        // * SetPixelShaderPath?
        // * SetWindowTheme (light/dark/system/<some theme from #3327>)?

Review comment (suggestion):
```suggestion
                    control.PreviewInput(hstring{});
```

stylistic nit: always prefer empty hstring over `L""`

Code after:
            control.AdjustOpacity(args.Opacity() / 100.0f, args.Relative());

            if (backup)
            {
                _restorePreviewFuncs.emplace_back([=]() {
                    // On dismiss:
                    // Don't adjust relatively, just set outright.
                    control.AdjustOpacity(originalOpacity, false);
                });
            }
        });
    }

    void TerminalPage::_PreviewSendInput(const Settings::Model::SendInputArgs& args)
    {
        const auto backup = _restorePreviewFuncs.empty();

        _ApplyToActiveControls([&](const auto& control) {
            const auto& str{ args.Input() };
            control.PreviewInput(str);

            if (backup)
            {
                _restorePreviewFuncs.emplace_back([=]() {
                    // On dismiss:
                    control.PreviewInput(hstring{});
                });
            }
        });
    }

    void TerminalPage::_PreviewAction(const Settings::Model::ActionAndArgs& args)
    {
        switch (args.Action())
        {
        case ShortcutAction::SetColorScheme:
            _PreviewColorScheme(args.Args().try_as<SetColorSchemeArgs>());
            break;
        case ShortcutAction::AdjustOpacity:
            _PreviewAdjustOpacity(args.Args().try_as<AdjustOpacityArgs>());
            break;
        case ShortcutAction::SendInput:
            _PreviewSendInput(args.Args().try_as<SendInputArgs>());
            break;
        }

        // GH#9818 Other ideas for actions that could be preview-able:
        // * Set Font size
        // * Set acrylic true/false/opacity?
        // * SetPixelShaderPath?
        // * SetWindowTheme (light/dark/system/<some theme from #3327>)?