Module: RubyTUI::Input::Key

Defined in:
lib/rubytui/input/key.rb

Overview

Key codes and modifier flags used by KeyEvent and MouseEvent.

Key codes are Symbols stored in KeyEvent#code; modifier flags are Integer bits OR'd together in the modifiers of KeyEvent and MouseEvent.

Examples:

case event.code
when Input::Key::ENTER then submit
when Input::Key::CHAR  then insert(event.char)
end

Key Codes collapse

CHAR =

Character key; the character itself is in KeyEvent#char.

:char
ENTER =

Enter / Return.

:enter
ESCAPE =

Escape.

:escape
BACKSPACE =

Backspace.

:backspace
DELETE =

Delete (forward delete).

:delete
TAB =

Tab.

:tab
BACKTAB =

Shift+Tab (back-tab).

:backtab
UP =

Up arrow.

:up
DOWN =

Down arrow.

:down
LEFT =

Left arrow.

:left
RIGHT =

Right arrow.

:right
HOME =

Home.

:home
END_KEY =

End.

:end
PAGE_UP =

Page Up.

:page_up
PAGE_DOWN =

Page Down.

:page_down
INSERT =

Insert.

:insert
F1 =

Function key F1.

:f1
F2 =

Function key F2.

:f2
F3 =

Function key F3.

:f3
F4 =

Function key F4.

:f4
F5 =

Function key F5.

:f5
F6 =

Function key F6.

:f6
F7 =

Function key F7.

:f7
F8 =

Function key F8.

:f8
F9 =

Function key F9.

:f9
F10 =

Function key F10.

:f10
F11 =

Function key F11.

:f11
F12 =

Function key F12.

:f12

Modifier Flags collapse

NONE =

No modifier keys held.

0
SHIFT =

Shift modifier bit.

0b001
ALT =

Alt (Meta / Option) modifier bit.

0b010
CTRL =

Ctrl modifier bit.

0b100