README

moonbit-community/tty/input does not have a README file

#
InputEvent

pub(all) enum InputEvent {
Key(KeyEvent)
Mouse(MouseEvent)
Paste(String)
FocusIn
FocusOut
Unknown(Bytes)
} derive(Eq,
Debug
)

User input decoded from terminal bytes.

Unsupported, malformed, invalid UTF-8, or unclosed sequences are preserved as Unknown bytes instead of becoming decoder errors.

#
KeyCode

pub(all) enum KeyCode {
Char(Char)
Text
Enter
Tab
Backspace
Delete
Escape
Up
Down
Left
Right
Home
End
PageUp
PageDown
Insert
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
CapsLock
ScrollLock
NumLock
PrintScreen
Pause
Menu
KeypadBegin
Keypad0
Keypad1
Keypad2
Keypad3
Keypad4
Keypad5
Keypad6
Keypad7
Keypad8
Keypad9
KeypadDecimal
KeypadDivide
KeypadMultiply
KeypadMinus
KeypadPlus
KeypadEnter
KeypadEqual
KeypadSeparator
Media(MediaKeyCode)
Modifier(ModifierKeyCode)
} derive(Eq,
Debug
)

Logical key code decoded from terminal input.

#
KeyEvent

pub struct KeyEvent {
code : KeyCode
modifiers : KeyModifiers
kind : KeyEventKind
state : KeyEventState
text : String?
shifted_code : KeyCode?
base_code : KeyCode?
} derive(Eq,
Debug
)

Decoded key event.

text is decoded terminal text when present. It is not a grapheme, display width, or cursor-motion contract.

shifted_code and base_code are available when kitty keyboard protocol alternate key reports are enabled. shifted_code is the shifted key in the active layout; base_code is the key in a standard PC-101 layout.

#
KeyEvent::new

fn KeyEvent::new(code : KeyCode, modifiers? : KeyModifiers, text? : String, kind? : KeyEventKind, state? : KeyEventState, shifted_code? : KeyCode, base_code? : KeyCode) -> KeyEvent

Construct a key event.

#
KeyEventKind

pub(all) enum KeyEventKind {
Press
Repeat
Release
} derive(Eq,
Debug
)

Keyboard event action.

#
KeyEventState

type KeyEventState derive(Eq,
Debug
)

Opaque set of keyboard event state flags.

#
KeyEventState::caps_lock

fn KeyEventState::caps_lock(self : KeyEventState) -> Bool

Return whether Caps Lock was active for the key event.

#
KeyEventState::keypad

fn KeyEventState::keypad(self : KeyEventState) -> Bool

Return whether the event originated from the keypad.

#
KeyEventState::new

fn KeyEventState::new(keypad? : Bool, caps_lock? : Bool, num_lock? : Bool) -> KeyEventState

Construct a keyboard event state set.

#
KeyEventState::num_lock

fn KeyEventState::num_lock(self : KeyEventState) -> Bool

Return whether Num Lock was active for the key event.

#
KeyModifiers

type KeyModifiers derive(Eq,
Debug
)

Opaque set of key modifiers.

#
KeyModifiers::alt

fn KeyModifiers::alt(self : KeyModifiers) -> Bool

Return whether the Alt modifier is set.

#
KeyModifiers::ctrl

fn KeyModifiers::ctrl(self : KeyModifiers) -> Bool

Return whether the Ctrl modifier is set.

#
KeyModifiers::hyper

fn KeyModifiers::hyper(self : KeyModifiers) -> Bool

Return whether the Hyper modifier is set.

#
KeyModifiers::meta

fn KeyModifiers::meta(self : KeyModifiers) -> Bool

Return whether the Meta modifier is set.

#
KeyModifiers::new

fn KeyModifiers::new(shift? : Bool, alt? : Bool, ctrl? : Bool, meta? : Bool, super_? : Bool, hyper? : Bool) -> KeyModifiers

Construct a modifier set.

#
KeyModifiers::shift

fn KeyModifiers::shift(self : KeyModifiers) -> Bool

Return whether the Shift modifier is set.

#
KeyModifiers::super_

fn KeyModifiers::super_(self : KeyModifiers) -> Bool

Return whether the Super modifier is set.

#
MediaKeyCode

pub(all) enum MediaKeyCode {
Play
Pause
PlayPause
Reverse
Stop
FastForward
Rewind
TrackNext
TrackPrevious
Record
LowerVolume
RaiseVolume
MuteVolume
} derive(Eq,
Debug
)

Media key decoded from kitty keyboard functional key reports.

#
ModifierKeyCode

pub(all) enum ModifierKeyCode {
LeftShift
LeftControl
LeftAlt
LeftSuper
LeftHyper
LeftMeta
RightShift
RightControl
RightAlt
RightSuper
RightHyper
RightMeta
IsoLevel3Shift
IsoLevel5Shift
} derive(Eq,
Debug
)

Modifier key decoded from kitty keyboard functional key reports.

#
MouseButton

pub(all) enum MouseButton {
Left
Middle
Right
} derive(Eq,
Debug
)

Supported mouse buttons.

#
MouseEvent

pub struct MouseEvent {
kind : MouseEventKind
row : Int
col : Int
modifiers : KeyModifiers
} derive(Eq,
Debug
)

Decoded mouse event.

Rows and columns are 1-based terminal cell coordinates.

#
MouseEvent::new

fn MouseEvent::new(kind : MouseEventKind, row : Int, col : Int, modifiers? : KeyModifiers) -> MouseEvent

Construct a mouse event with optional key modifiers.

#
MouseEventKind

pub(all) enum MouseEventKind {
Press(MouseButton)
Release(MouseButton)
Drag(MouseButton)
Move
Scroll(MouseScroll)
} derive(Eq,
Debug
)

Mouse input action decoded from an SGR mouse report.

#
MouseScroll

pub(all) enum MouseScroll {
Up
Down
Left
Right
} derive(Eq,
Debug
)

Supported mouse scroll directions.

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io