RFR 8147984: WindowsTerminal should support function keys

Stuart Marks stuart.marks at oracle.com
Fri Apr 29 21:49:40 UTC 2016

Hi Jan,

I finally got a chance to take a look at this. The change looks fine.

It would be nice to have a reference to where the escape sequences are 
documented. There are links to the Windows VK_ codes there, which is great. But 
there's no reference for the escape sequences that each keypress is mapped to, 
e.g. F4 is "ESC O S", and F5 is "ESC [ 1 5 ~" (and what happened to "ESC [ 1 6 ~"??)

I did some searching, and it seems really hard to find a definitive reference. 
Perhaps the best reference is "XTerm Control Sequences" [1] which seems to 
document xterm pretty thoroughly, which is what everybody seems to follow 
nowadays. It even looks like it's being kept up to date (last modified 2016-02-21).

Anyway I'd suggest adding a comment with a reference to this document.

As a cross-check, these sequences match what my Mac's Terminal.app emits, at 
least for unshifted F1-F12. (The Terminal app was probably copied from xterm.)



[1] http://invisible-island.net/xterm/ctlseqs/ctlseqs.html

On 1/22/16 3:41 AM, Jan Lahoda wrote:
> Hello,
> I'd like to enhance the WindowsTerminal in jdk.internal.le with function keys
> handling. The intent is so that jshell can bind actions for shortcuts including
> function keys.
> The patch for adding the function keys support is here:
> http://cr.openjdk.java.net/~jlahoda/8147984/webrev.00/
> An example of a feature that uses/may use this support is here:
> http://mail.openjdk.java.net/pipermail/kulla-dev/2016-January/001226.html
> Any comments are welcome!
> Thanks,
>    Jan

More information about the core-libs-dev mailing list