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

Code before:
    {
        const til::point terminalPosition = _getTerminalPosition(pixelPosition);

        const auto altEnabled = modifiers.IsAltPressed();
        const auto shiftEnabled = modifiers.IsShiftPressed();
        const auto ctrlEnabled = modifiers.IsCtrlPressed();

        // GH#9396: we prioritize hyper-link over VT mouse events
        auto hyperlink = _core->GetHyperlink(terminalPosition);
        if (buttonState.isLeftButtonDown &&
            ctrlEnabled && !hyperlink.empty())
        {
            const auto clickCount = _numberOfClicks(pixelPosition, timestamp);
            // Handle hyper-link only on the first click to prevent multiple activations
            if (clickCount == 1)
            {
                _hyperlinkHandler(hyperlink);
            }
        }
        else if (_canSendVTMouseInput(modifiers))
        {
            auto adjustment = 0;
            if (_core->ScrollOffset() > 0)
            {
                adjustment = _core->BufferHeight() - _core->ScrollOffset() - _core->ViewHeight();
            }
            _core->SendMouseEvent({ terminalPosition.x(), terminalPosition.y() - adjustment }, pointerUpdateKind, modifiers, 0, buttonState);
        }
        else if (buttonState.isLeftButtonDown)
        {
            const auto clickCount = _numberOfClicks(pixelPosition, timestamp);
            // This formula enables the number of clicks to cycle properly
            // between single-, double-, and triple-click. To increase the
            // number of acceptable click states, simply increment
            // MAX_CLICK_COUNT and add another if-statement
            const auto multiClickMapper = clickCount > MAX_CLICK_COUNT ? ((clickCount + MAX_CLICK_COUNT - 1) % MAX_CLICK_COUNT) + 1 : clickCount;

            // Capture the position of the first click when no selection is active
            if (multiClickMapper == 1)
            {
                _singleClickTouchdownPos = pixelPosition;

                if (!_core->HasSelection())
                {
                    _lastMouseClickPosNoSelection = pixelPosition;
                }
            }
            const bool isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition;

            _core->LeftClickOnTerminal(terminalPosition,
                                       multiClickMapper,

Review comment (suggestion):
```suggestion
            const auto adjustment = _core->ScrollOffset() > 0 ? _core->BufferHeight() - _core->ScrollOffset() - _core->ViewHeight() : 
                                                                0;
```
If you use a ternary operator, you can throw a `const` in there

Code after:
        }

        return false;
    }

    // Method Description:
    // - Initiate a paste operation.
    void ControlInteractivity::RequestPasteTextFromClipboard()
    {
        // attach ControlInteractivity::_sendPastedTextToConnection() as the
        // clipboardDataHandler. This is called when the clipboard data is
        // loaded.
        auto clipboardDataHandler = std::bind(&ControlInteractivity::_sendPastedTextToConnection, this, std::placeholders::_1);
        auto pasteArgs = winrt::make_self<PasteFromClipboardEventArgs>(clipboardDataHandler);

        // send paste event up to TermApp
        _PasteFromClipboardHandlers(*this, *pasteArgs);
    }

    // Method Description:
    // - Pre-process text pasted (presumably from the clipboard)
    //   before sending it over the terminal's connection.
    void ControlInteractivity::_sendPastedTextToConnection(std::wstring_view wstr)
    {
        _core->PasteText(winrt::hstring{ wstr });
    }

    void ControlInteractivity::PointerPressed(Control::MouseButtonState buttonState,
                                              const unsigned int pointerUpdateKind,
                                              const uint64_t timestamp,
                                              const ::Microsoft::Terminal::Core::ControlKeyStates modifiers,
                                              const til::point pixelPosition)
    {
        const til::point terminalPosition = _getTerminalPosition(pixelPosition);

        const auto altEnabled = modifiers.IsAltPressed();
        const auto shiftEnabled = modifiers.IsShiftPressed();
        const auto ctrlEnabled = modifiers.IsCtrlPressed();

        // GH#9396: we prioritize hyper-link over VT mouse events
        auto hyperlink = _core->GetHyperlink(terminalPosition);
        if (WI_IsFlagSet(buttonState, MouseButtonState::IsLeftButtonDown) &&
            ctrlEnabled && !hyperlink.empty())
        {
            const auto clickCount = _numberOfClicks(pixelPosition, timestamp);
            // Handle hyper-link only on the first click to prevent multiple activations
            if (clickCount == 1)
            {
                _hyperlinkHandler(hyperlink);
            }
        }