etch/javascript/input

Values

pub fn get_cursor_position() -> promise.Promise(
  Result(#(Int, Int), event.EventError),
)

Returns cursor position. This function shouldn’t be called in a tight loop. It’s fine to call it when responding to specific user input (e.g., after a key press), but avoid calling it on every loop iteration.

pub fn get_keyboard_enhancement_flags() -> promise.Promise(
  Result(List(event.KeyboardEnhancementFlag), event.EventError),
)

Get keyboard enhancement flags. See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement This function shouldn’t be called in a tight loop. It’s fine to call it when responding to specific user input (e.g., after a key press), but avoid calling it on every loop iteration.

pub fn init_event_server() -> promise.Promise(a)

Initializes the event server responsible for listening for events.

pub fn poll(
  timeout: Int,
) -> promise.Promise(
  option.Option(Result(event.Event, event.EventError)),
)

Checks if there is an Event available. Returns None if no events were received within the timeout. See also read.

pub fn read() -> promise.Promise(
  option.Option(Result(event.Event, event.EventError)),
)

Checks if there is an Event available. Waits forever for an available event. See also poll.

Search Document