Skip to content

Latest commit

 

History

History
168 lines (140 loc) · 20.1 KB

File metadata and controls

168 lines (140 loc) · 20.1 KB

Notation matrix for crossterm and termion

Event Notation

Format

e.g., Ctrl+C, Ctrl+Shift+F1, Alt+Left, LeftDown, Ctrl+ScrollUp

Key crossterm termion Notes
<key> Event::Key + KeyCode Key e.g., Enter, F1, A
<modifier>(+<modifier>)*+<key> KeyEvent::modifiers + KeyCode Modifier variants in Key e.g., Ctrl+Shift+F1; termion supports only specific combinations
<mouse> Event::Mouse + MouseEventKind MouseEvent / MouseButton e.g., LeftDown, ScrollUp
<modifier>(+<modifier>)*+<mouse> MouseEvent::modifiers + MouseEventKind No Not supported in termion

Modifiers

Key crossterm termion Notes
Ctrl KeyModifiers::CONTROL Key::Ctrl
Alt KeyModifiers::ALT Key::Alt
Shift KeyModifiers::SHIFT Key::ShiftLeft
Super KeyModifiers::SUPER No Rejected by termion conversion
Hyper KeyModifiers::HYPER No Rejected by termion conversion
Meta KeyModifiers::META No Rejected by termion conversion

Supported key + modifier combinations in termion:

  • Shift+Left, Shift+Right, Shift+Up, Shift+Down
  • Alt+Left, Alt+Right, Alt+Up, Alt+Down
  • Ctrl+Left, Ctrl+Right, Ctrl+Up, Ctrl+Down
  • Ctrl+Home, Ctrl+End
  • Shift+Tab (normalized as BackTab)
  • Shift+<char>, Alt+<char>, Ctrl+<char> (single character)

Key Tokens

Key crossterm termion Notes
Backspace KeyCode::Backspace Key::Backspace
Enter KeyCode::Enter Key::Char termion uses \n
Left KeyCode::Left Key::Left
Right KeyCode::Right Key::Right
Up KeyCode::Up Key::Up
Down KeyCode::Down Key::Down
Home KeyCode::Home Key::Home
End KeyCode::End Key::End
PageUp KeyCode::PageUp Key::PageUp
PageDown KeyCode::PageDown Key::PageDown
Tab KeyCode::Tab Key::Char termion uses \t
BackTab KeyCode::BackTab Key::BackTab
Delete KeyCode::Delete Key::Delete
Insert KeyCode::Insert Key::Insert
F1 KeyCode::F Key::F Same for F2 and above
A..Z KeyCode::Char Key::Char Any single character
Space KeyCode::Char Key::Char Represents ' '
Minus KeyCode::Char Key::Char Represents '-'
Plus KeyCode::Char Key::Char Represents '+'
Null KeyCode::Null Key::Null
Esc KeyCode::Esc Key::Esc
CapsLock KeyCode::CapsLock No Not supported in termion
ScrollLock KeyCode::ScrollLock No Not supported in termion
NumLock KeyCode::NumLock No Not supported in termion
PrintScreen KeyCode::PrintScreen No Not supported in termion
Pause KeyCode::Pause No Not supported in termion
Menu KeyCode::Menu No Not supported in termion
KeypadBegin KeyCode::KeypadBegin No Not supported in termion

Mouse Tokens

Key crossterm termion Notes
LeftDown MouseEventKind::Down MouseEvent::Press
RightDown MouseEventKind::Down MouseEvent::Press
MiddleDown MouseEventKind::Down MouseEvent::Press
LeftUp MouseEventKind::Up No Not supported in termion
RightUp MouseEventKind::Up No Not supported in termion
MiddleUp MouseEventKind::Up No Not supported in termion
LeftDrag MouseEventKind::Drag No Not supported in termion
RightDrag MouseEventKind::Drag No Not supported in termion
MiddleDrag MouseEventKind::Drag No Not supported in termion
Moved MouseEventKind::Moved No Not supported in termion
ScrollDown MouseEventKind::ScrollDown MouseButton::WheelDown represented as Press(WheelDown, ..) in termion
ScrollUp MouseEventKind::ScrollUp MouseButton::WheelUp represented as Press(WheelUp, ..) in termion
ScrollLeft MouseEventKind::ScrollLeft MouseButton::WheelLeft represented as Press(WheelLeft, ..) in termion
ScrollRight MouseEventKind::ScrollRight MouseButton::WheelRight represented as Press(WheelRight, ..) in termion

Additional backend constraints

Style Notation

Format

e.g., fg=red,bg=#00FF00,ul=blue,attr=bold|italic

Key crossterm termion Notes
fg=<color> ContentStyle::foreground_color color::Fg
bg=<color> ContentStyle::background_color color::Bg
ul=<color> ContentStyle::underline_color No Underline color is not supported in termion
attr=<token|token...> Attribute style module

Color Tokens

Key crossterm termion Notes
reset, black, red, green, yellow, blue, magenta, cyan, white Color enum color module
darkgrey, darkred, darkgreen, darkyellow, darkblue, darkmagenta, darkcyan, grey Color enum No Not supported in termion
lightblack, lightred, lightgreen, lightyellow, lightblue, lightmagenta, lightcyan, lightwhite No color module Not supported in crossterm
#RRGGBB Color::Rgb color::Rgb

Unsupported tokens

  • 0..255 (e.g., 200): Color::AnsiValue / color::AnsiValue exist in backend types, but are currently out of this crate's notation input/output contract. Support for ANSI 256-color tokens may be added in a future release.

Attribute Tokens

Key crossterm termion Notes
reset Attribute::Reset style::Reset
bold Attribute::Bold style::Bold
italic Attribute::Italic style::Italic
crossedout Attribute::CrossedOut style::CrossedOut
nobold Attribute::NoBold style::NoBold
noitalic Attribute::NoItalic style::NoItalic
nounderline Attribute::NoUnderline style::NoUnderline
noblink Attribute::NoBlink style::NoBlink
framed Attribute::Framed style::Framed

For crossterm

Key crossterm Notes
underlined Attribute::Underlined
dim Attribute::Dim
slowblink Attribute::SlowBlink
rapidblink Attribute::RapidBlink
reverse Attribute::Reverse
noreverse Attribute::NoReverse
notcrossedout Attribute::NotCrossedOut
normalintensity Attribute::NormalIntensity
doubleunderlined Attribute::DoubleUnderlined
undercurled Attribute::Undercurled
underdotted Attribute::Underdotted
underdashed Attribute::Underdashed
hidden Attribute::Hidden
fraktur Attribute::Fraktur
nohidden Attribute::NoHidden
encircled Attribute::Encircled
overlined Attribute::OverLined
notframedorencircled Attribute::NotFramedOrEncircled
notoverlined Attribute::NotOverLined

For termion

Key termion Notes
underline style::Underline
faint style::Faint
blink style::Blink
invert style::Invert
noinvert style::NoInvert
nocrossedout style::NoCrossedOut
nofaint style::NoFaint