Repository: microsoft/terminal
File: src/terminal/input/mouseInput.cpp (C++)

Code before:
                _mouseInputState.lastPos.y = position.y;
                _mouseInputState.lastButton = button;
            }

            if (_inputMode.test(Mode::Utf8MouseEncoding))
            {
                return _GenerateUtf8Sequence(position, realButton, isHover, modifierKeyState, delta);
            }
            else if (_inputMode.test(Mode::SgrMouseEncoding))
            {
                // For SGR encoding, if no physical buttons were pressed,
                // then we want to handle hovers with WM_MOUSEMOVE.
                // However, if we're dragging (WM_MOUSEMOVE with a button pressed),
                //      then use that pressed button instead.
                return _GenerateSGRSequence(position, physicalButtonPressed ? realButton : button, _isButtonUp(button), isHover, modifierKeyState, delta);
            }
            else
            {
                return _GenerateDefaultSequence(position, realButton, isHover, modifierKeyState, delta);
            }
        }
    }

    if (ShouldSendAlternateScroll(button, delta))
    {
        return _makeAlternateScrollOutput(button ,delta);
    }

    return {};
}

// Routine Description:
// - Generates a sequence encoding the mouse event according to the default scheme.
//     see http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
// Parameters:
// - position - The windows coordinates (top,left = 0,0) of the mouse event
// - button - the message to decode.
// - isHover - true if the sequence is generated in response to a mouse hover
// - modifierKeyState - the modifier keys pressed with this button
// - delta - the amount that the scroll wheel changed (should be 0 unless button is a WM_MOUSE*WHEEL)
TerminalInput::OutputType TerminalInput::_GenerateDefaultSequence(const til::point position, const unsigned int button, const bool isHover, const short modifierKeyState, const short delta)
{
    // In the default, non-extended encoding scheme, coordinates above 94 shouldn't be supported,
    //   because (95+32+1)=128, which is not an ASCII character.
    // There are more details in _GenerateUtf8Sequence, but basically, we can't put anything above x80 into the input
    //   stream without bash.exe trying to convert it into utf8, and generating extra bytes in the process.
    if (position.x <= s_MaxDefaultCoordinate && position.y <= s_MaxDefaultCoordinate)
    {
        const auto vtCoords = _winToVTCoord(position);
        const auto encodedX = _encodeDefaultCoordinate(vtCoords.x);
        const auto encodedY = _encodeDefaultCoordinate(vtCoords.y);

Review comment (suggestion):
Space assumedly meant to be after the comma. I suspect there also other formatting issues that the Code Health Check will complain about if/when the CI eventually runs. There's a `runformat.cmd` script in the `terminal\tools` directory that you can run locally which should fix issues like this automatically.

Code after:
                _mouseInputState.lastPos.y = position.y;
                _mouseInputState.lastButton = button;
            }

            if (_inputMode.test(Mode::Utf8MouseEncoding))
            {
                return _GenerateUtf8Sequence(position, realButton, isHover, modifierKeyState, delta);
            }
            else if (_inputMode.test(Mode::SgrMouseEncoding))
            {
                // For SGR encoding, if no physical buttons were pressed,
                // then we want to handle hovers with WM_MOUSEMOVE.
                // However, if we're dragging (WM_MOUSEMOVE with a button pressed),
                //      then use that pressed button instead.
                return _GenerateSGRSequence(position, physicalButtonPressed ? realButton : button, _isButtonUp(button), isHover, modifierKeyState, delta);
            }
            else
            {
                return _GenerateDefaultSequence(position, realButton, isHover, modifierKeyState, delta);
            }
        }
    }

    if (ShouldSendAlternateScroll(button, delta))
    {
        return _makeAlternateScrollOutput(button, delta);
    }

    return {};
}

// Routine Description:
// - Generates a sequence encoding the mouse event according to the default scheme.
//     see http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
// Parameters:
// - position - The windows coordinates (top,left = 0,0) of the mouse event
// - button - the message to decode.
// - isHover - true if the sequence is generated in response to a mouse hover
// - modifierKeyState - the modifier keys pressed with this button
// - delta - the amount that the scroll wheel changed (should be 0 unless button is a WM_MOUSE*WHEEL)
TerminalInput::OutputType TerminalInput::_GenerateDefaultSequence(const til::point position, const unsigned int button, const bool isHover, const short modifierKeyState, const short delta)
{
    // In the default, non-extended encoding scheme, coordinates above 94 shouldn't be supported,
    //   because (95+32+1)=128, which is not an ASCII character.
    // There are more details in _GenerateUtf8Sequence, but basically, we can't put anything above x80 into the input
    //   stream without bash.exe trying to convert it into utf8, and generating extra bytes in the process.
    if (position.x <= s_MaxDefaultCoordinate && position.y <= s_MaxDefaultCoordinate)
    {
        const auto vtCoords = _winToVTCoord(position);
        const auto encodedX = _encodeDefaultCoordinate(vtCoords.x);
        const auto encodedY = _encodeDefaultCoordinate(vtCoords.y);