Skip to content

Support extra side mouse buttons in MacVim (X1 and X2) #1534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/doc/term.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ Mouse clicks can be mapped. The codes for mouse clicks are:

The X1 and X2 buttons refer to the extra buttons found on some mice. The
'Microsoft Explorer' mouse has these buttons available to the right thumb.
Currently X1 and X2 only work on Win32 and X11 environments.
Currently X1 and X2 only work on MacVim, Win32, and X11 environments.

Examples: >
:noremap <MiddleMouse> <LeftMouse><MiddleMouse>
Expand Down
4 changes: 2 additions & 2 deletions src/MacVim/MMBackend.m
Original file line number Diff line number Diff line change
Expand Up @@ -3793,9 +3793,9 @@ static unsigned eventModifierFlagsToVimMouseModMask(unsigned modifierFlags)

static int eventButtonNumberToVimMouseButton(int buttonNumber)
{
static int mouseButton[] = { MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE };
static int mouseButton[] = { MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE, MOUSE_X1, MOUSE_X2 };

return (buttonNumber >= 0 && buttonNumber < 3)
return (buttonNumber >= 0 && buttonNumber < 5)
? mouseButton[buttonNumber] : -1;
}

Expand Down
Loading