console enhancements: mouse events

Thomas Wolff
Wed Nov 11 17:56:00 GMT 2009

Corinna Vinschen wrote:
>>>> * Maybe the escape sequences of shifted function keys should be
>>>> modified   to comply with those of the Linux console?
>>> Aren't they compatible with xterm?  I don't think it's a terrible good
>>> idea to change that.
>> No, they are not:
>> Linux console
>> F1..F12         ^[[[A ^[[[B ^[[[C ^[[[D ^[[[E ^[[17~ ^[[18~ ^[[19~
>> ^[[20~ ^[[21~ ^[[23~ ^[[24~
>> shift-F1..F8    ^[[25~ ^[[26~ ^[[28~ ^[[29~ ^[[31~ ^[[32~ ^[[33~ ^[[34~
>> cygwin console
>> F1..F12         ^[[[A ^[[[B ^[[[C ^[[[D ^[[[E ^[[17~ ^[[18~ ^[[19~
>> ^[[20~ ^[[21~ ^[[23~ ^[[24~
>> shift-F1..F10   ^[[23~ ^[[24~ ^[[25~ ^[[26~ ^[[28~ ^[[29~ ^[[31~
>> ^[[32~ ^[[33~ ^[[34~
>> [...]
>>  Furthermore, xterm and mintty also support
>> Control- and Alt-modified F-keys and combinations of the modifiers.
>> So if your preference would be to follow xterm here anyway, I would
>> welcome this change and provide a patch; I think this change can be
>> done without compatibility trouble in "mainstream applications"
>> since the shifted F-keys are not listed in the cygwin terminfo
>> entry.
> Ooookey, if they aren't listed in terminfo anyway, I have no problems
> to change them.  But we should stick to following the Linux console,
> I guess.
Well, cygwin console is actually following rxvt and VT220 here (which I 
should have included in my survey for completeness), while Linux console 
is deviating from VT220, so there is at least some kind of consistence 
in the cygwin console. (Contemplating that rxvt and VT220 are both 
If you don't like my suggestion to switch to the unanbigous sequences of 
xterm and mintty (still my favorite), I'll not pursue this issue further 
because I don't want to be blamed for potential confusion of a 
"shift-by-2" change. It would still be an option to fill the unmapped 
combinations (esp. with Ctrl and Alt), in that case probably in the 
style of rxvt.

About the Alt-AltGr issue (which is orthogonal to the previous 
Alt-non-ASCII issue):
>> ... e.g. Alt-AltGr-Q where AltGr-Q is @ (German keyboard).
>> ...; it does not work in xterm either.
(which isn't quite true; it works with the resource metaSendsEscape: true)

- I found a very simple patch, just one additional line (the third below):
              meta = (control_key_state & ALT_PRESSED) != 0
                     && ((control_key_state & CTRL_PRESSED) == 0
                         || (control_key_state & ALT_PRESSED) == ALT_PRESSED
                         || (wch <= 0x1f || wch == 0x7f));

and Alt-AltGr-Q delivers ESC @ as expected (German keyboard, AltGr-Q = @).

> That's potentially too tricky for the current code.  And, whatever
> super-duper change we make to this essential console code in future,
> let's wait until after 1.7.1, please.
Thanks Andy for previous hints that enabled me find the solution, 
otherwise it would have been too tricky; the actual solution isn't.
Changes about the basic Ctrl-key layout for international keyboards are 
more super-duper apparently and will have to wait.


More information about the Cygwin-patches mailing list