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

Code before:
            if (const auto activePane{ activeTab->GetActivePane() })
            {
                _restartPaneConnection(activePane->GetContent().try_as<TerminalApp::TerminalPaneContent>(), nullptr);
            }
        }
        args.Handled(true);
    }

    void TerminalPage::_HandleShowContextMenu(const IInspectable& /*sender*/,
                                              const ActionEventArgs& args)
    {
        if (const auto& control{ _GetActiveControl() })
        {
            control.ShowContextMenu();
        }
        args.Handled(true);
    }

    void TerminalPage::_HandleOpenScratchpad(const IInspectable& /*sender*/,
                                             const ActionEventArgs& args)
    {
        if (Feature_ScratchpadPane::IsEnabled())
        {
            auto scratchPane{ winrt::make_self<ScratchpadContent>() };

            // This is maybe a little wacky - add our key event handler to the pane
            // we made. So that we can get actions for keys that the content didn't
            // handle.
            scratchPane->GetRoot().KeyDown({ this, &TerminalPage::_KeyDownHandler });

            auto resultPane = std::make_shared<Pane>(*scratchPane);
            _SplitPane(_GetFocusedTabImpl(), SplitDirection::Automatic, 0.5f, resultPane);
            args.Handled(true);
        }
    }

    void TerminalPage::_HandleOpenAbout(const IInspectable& /*sender*/,
                                        const ActionEventArgs& args)
    {
        _ShowAboutDialog();
        args.Handled(true);
    }
}


Review comment (suggestion):
I've got a few questions about actions:
- Is the order of handling "Default TextBox key bindings" --> "Terminal key bindings"?
- (building off of the above) What happens if the user presses ctrl+shift+c and that's set as "copy" in the settings?
- Can the user open the command palette and run a command from there? What do we do for some that make sense like "copy", "paste", "setFontSize", "searchWeb", "
- I'm assuming all the pane actions work? (zoom, close, etc...)
- [Feature Request] hook up "exportBuffer" to this so that it saves the contents to a file?

I'm having a hard time understanding where the line is between "full blown text editor" and "text box in a pane", so I'm ok with you rejecting some of the ideas above. That said, I think a few of them (namely copy, paste, and font size [maybe searchWeb, but that one I care less about tbh]) are important.

Code after:
            }
        }
        args.Handled(true);
    }

    void TerminalPage::_HandleShowContextMenu(const IInspectable& /*sender*/,
                                              const ActionEventArgs& args)
    {
        if (const auto& control{ _GetActiveControl() })
        {
            control.ShowContextMenu();
        }
        args.Handled(true);
    }

    void TerminalPage::_HandleOpenScratchpad(const IInspectable& /*sender*/,
                                             const ActionEventArgs& args)
    {
        if (Feature_ScratchpadPane::IsEnabled())
        {
            const auto& scratchPane{ winrt::make_self<ScratchpadContent>() };

            // This is maybe a little wacky - add our key event handler to the pane
            // we made. So that we can get actions for keys that the content didn't
            // handle.
            scratchPane->GetRoot().KeyDown({ this, &TerminalPage::_KeyDownHandler });

            const auto resultPane = std::make_shared<Pane>(*scratchPane);
            _SplitPane(_GetFocusedTabImpl(), SplitDirection::Automatic, 0.5f, resultPane);
            args.Handled(true);
        }
    }

    void TerminalPage::_HandleOpenAbout(const IInspectable& /*sender*/,
                                        const ActionEventArgs& args)
    {
        _ShowAboutDialog();
        args.Handled(true);
    }
}