-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add support for mouse buttons 8 and 9 to terminals with xterm-like mouse support #18719
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
Changes from all commits
4578ebd
c53bc9a
7620496
b21290e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -1641,6 +1641,64 @@ func Test_mouse_termcodes() | |||
| %bw! | ||||
| endfunc | ||||
|
|
||||
| " Test buttons 8 and 9 for xterm-like terminal mouse support | ||||
| func Test_term_mouse_side_buttons() | ||||
| new | ||||
| let save_mouse = &mouse | ||||
| let save_term = &term | ||||
| let save_ttymouse = &ttymouse | ||||
| call test_override('no_query_mouse', 1) | ||||
| set mouse=a term=xterm | ||||
| call WaitForResponses() | ||||
|
|
||||
| for ttymouse_val in g:Ttymouse_values | ||||
| let msg = 'ttymouse=' .. ttymouse_val | ||||
| exe 'set ttymouse=' .. ttymouse_val | ||||
|
|
||||
| let mouse_codes = [ | ||||
| \ ["<X1Mouse>", TerminalEscapeCode(128, 1, 1, 'M')], | ||||
| \ ["<X1Drag>", TerminalEscapeCode(128+32, 1, 1, 'M')], | ||||
| \ ["<X2Mouse>", TerminalEscapeCode(129, 1, 1, 'M')], | ||||
| \ ["<X2Drag>", TerminalEscapeCode(129+32, 1, 1, 'M')], | ||||
| \ ["<S-X1Mouse>", TerminalEscapeCode(128+4, 1, 1, 'M')], | ||||
| \ ["<S-X2Mouse>", TerminalEscapeCode(129+4, 1, 1, 'M')], | ||||
| \ ["<M-X1Mouse>", TerminalEscapeCode(128+8, 1, 1, 'M')], | ||||
| \ ["<M-X2Mouse>", TerminalEscapeCode(129+8, 1, 1, 'M')], | ||||
| \ ["<C-X1Mouse>", TerminalEscapeCode(128+16, 1, 1, 'M')], | ||||
| \ ["<C-X2Mouse>", TerminalEscapeCode(129+16, 1, 1, 'M')], | ||||
| \ ] | ||||
|
|
||||
| for [outstr, code] in mouse_codes | ||||
| exe "normal ggC\<C-K>" . code | ||||
| " normal ggD | ||||
| " call feedkeys("i\<C-K>" . code, 'Lx!') | ||||
|
||||
| " call feedkeys("i\<C-K>" . code, 'Lx!') |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2095,6 +2095,9 @@ typedef int sock_T; | |||||
| // Lowest button code for using the mouse wheel (xterm only) | ||||||
| #define MOUSEWHEEL_LOW 0x60 | ||||||
|
|
||||||
| // Lowest button code for extra mouse buttons 8-11 | ||||||
|
||||||
| // Lowest button code for extra mouse buttons 8-11 | |
| // Lowest button code for extra mouse buttons 8-9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using
(orig_mouse_code & 0x01)instead of(current_button)for clarity. While the current logic is correct (relying on the LSB being preserved through the mask at line 2871), directly checking the LSB oforig_mouse_codewould make the intent more explicit: button 8 (0xa0) has LSB=0 → X1, button 9 (0xa1) has LSB=1 → X2.