| 1 |
Introduction |
| 2 |
============ |
| 3 |
|
| 4 |
The only specification I could find describing mouse input escape sequences |
| 5 |
was the /usr/share/doc/xterm/ctlseqs.txt.gz file installed on my Ubuntu |
| 6 |
machine. |
| 7 |
|
| 8 |
Here are the relevant escape sequences: |
| 9 |
|
| 10 |
* [ON] CSI '?' M 'h' Enable mouse input mode M |
| 11 |
* [OFF] CSI '?' M 'l' Disable mouse input mode M |
| 12 |
* [EVT] CSI 'M' F X Y Mouse event (default or mode 1005) |
| 13 |
* [EVT6] CSI '<' F ';' X ';' Y 'M' Mouse event with mode 1006 |
| 14 |
* [EVT6] CSI '<' F ';' X ';' Y 'm' Mouse event with mode 1006 (up) |
| 15 |
* [EVT15] CSI F ';' X ';' Y 'M' Mouse event with mode 1015 |
| 16 |
|
| 17 |
The first batch of modes affect what events are reported: |
| 18 |
|
| 19 |
* 9: Presses only (not as well-supported as the other modes) |
| 20 |
* 1000: Presses and releases |
| 21 |
* 1002: Presses, releases, and moves-while-pressed |
| 22 |
* 1003: Presses, releases, and all moves |
| 23 |
|
| 24 |
The next batch of modes affect the encoding of the mouse events: |
| 25 |
|
| 26 |
* 1005: The X and Y coordinates are UTF-8 codepoints rather than bytes. |
| 27 |
* 1006: Use the EVT6 sequences instead of EVT |
| 28 |
* 1015: Use the EVT15 sequence instead of EVT (aka URVXT-mode) |
| 29 |
|
| 30 |
Support for modes in existing terminals |
| 31 |
======================================= |
| 32 |
|
| 33 |
| 9 1000 1002 1003 | 1004 | overflow | defhi | 1005 1006 1015 |
| 34 |
---------------------------------+---------------------+------+--------------+-------+---------------- |
| 35 |
Eclipse TM Terminal (Neon) | _ _ _ _ | _ | n/a | n/a | _ _ _ |
| 36 |
gnome-terminal 3.6.2 | X X X X | _ | suppressed*b | 0x07 | _ X X |
| 37 |
iTerm2 2.1.4 | _ X X X | OI | wrap*z | n/a | X X X |
| 38 |
jediterm/IntelliJ | _ X X X | _ | ch='?' | 0xff | X X X |
| 39 |
Konsole 2.13.2 | _ X X *a | _ | suppressed | 0xff | X X X |
| 40 |
mintty 2.2.2 | X X X X | OI | ch='\0' | 0xff | X X X |
| 41 |
putty 0.66 | _ X X _ | _ | suppressed | 0xff | _ X X |
| 42 |
rxvt 2.7.10 | X X _ _ | _ | wrap*z | n/a | _ _ _ |
| 43 |
screen(under xterm) | X X X X | _ | suppressed | 0xff | _ _ _ |
| 44 |
urxvt 9.21 | X X X X | _ | wrap*z | n/a | X _ X |
| 45 |
xfce4-terminal 0.6.3 (GTK2 VTE) | X X X X | _ | wrap | n/a | _ _ _ |
| 46 |
xterm | X X X X | OI | ch='\0' | 0xff | X X X |
| 47 |
|
| 48 |
*a: Mode 1003 is handled the same way as 1002. |
| 49 |
*b: The coordinate wraps from 0xff to 0x00, then maxs out at 0x07. I'm |
| 50 |
guessing this behavior is a bug? I'm using the Xubuntu 14.04 |
| 51 |
gnome-terminal. |
| 52 |
*z: These terminals have a bug where column 224 (and row 224, presumably) |
| 53 |
yields a truncated escape sequence. 224 + 32 is 0, so it would normally |
| 54 |
yield `CSI 'M' F '\0' Y`, but the '\0' is interpreted as a NUL-terminator. |
| 55 |
|
| 56 |
Problem 1: How do these flags work? |
| 57 |
=================================== |
| 58 |
|
| 59 |
Terminals accept the OFF sequence with any of the input modes. This makes |
| 60 |
little sense--there are two multi-value settings, not seven independent flags! |
| 61 |
|
| 62 |
All the terminals handle Granularity the same way. ON-Granularity sets |
| 63 |
Granularity to the specified value, and OFF-Granularity sets Granularity to |
| 64 |
OFF. |
| 65 |
|
| 66 |
Terminals vary in how they handle the Encoding modes. For example: |
| 67 |
|
| 68 |
* xterm. ON-Encoding sets Encoding. OFF-Encoding with a non-active Encoding |
| 69 |
has no effect. OFF-Encoding otherwise resets Encoding to Default. |
| 70 |
|
| 71 |
* mintty (tested 2.2.2), iTerm2 2.1.4, and jediterm. ON-Encoding sets |
| 72 |
Encoding. OFF-Encoding resets Encoding to Default. |
| 73 |
|
| 74 |
* Konsole (tested 2.13.2) seems to configure each encoding method |
| 75 |
independently. The effective Encoding is the first enabled encoding in this |
| 76 |
list: |
| 77 |
- Mode 1006 |
| 78 |
- Mode 1015 |
| 79 |
- Mode 1005 |
| 80 |
- Default |
| 81 |
|
| 82 |
* gnome-terminal (tested 3.6.2) also configures each encoding method |
| 83 |
independently. The effective Encoding is the first enabled encoding in |
| 84 |
this list: |
| 85 |
- Mode 1006 |
| 86 |
- Mode 1015 |
| 87 |
- Default |
| 88 |
Mode 1005 is not supported. |
| 89 |
|
| 90 |
* xfce4 terminal 0.6.3 (GTK2 VTE) always outputs the default encoding method. |