egor7
egor7

Reputation: 4940

CTRL-UP hex sequence

What is the HEX sequence for CRTL-UP key-press? For example for UP - '0x1b, 0x5b, 0x41'.

Upvotes: 0

Views: 135

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 993951

I wrote a simple Python 3 script to find out the answer:

while True:
    print(" ".join("{:x}".format(ord(x)) for x in input()))

I had to turn off the standard "Mission control" shortcut for the CtrlUp keystroke, but after doing that I get the following in iTerm2:

$ python3 test.py
^[[A
1b 5b 41
^[[1;5A
1b 5b 31 3b 35 41

The first two lines represent an Up keypress, while the second two lines represent a CtrlUp. You can use this same program to find out the character sequences for any other keystrokes.

Upvotes: 1

Related Questions