etch/javascript/tty

Types

Event error.

pub type TerminalError {
  FailedToEnterRawMode
  FailedToExitRawMode
  CouldNotGetWindowSize
}

Constructors

  • FailedToEnterRawMode
  • FailedToExitRawMode
  • CouldNotGetWindowSize

Values

pub fn enter_raw() -> Result(Nil, TerminalError)

Enters raw mode.

Raw mode is a mode where the terminal does not process input, but instead passes it directly to the application. This means that:

  • Input is not echoed to the screen
  • Input is not line-buffered (characters are available immediately)
  • Some special characters are not processed by the terminal

This is necessary for terminal UI applications that need to handle keyboard input and mouse events directly.

pub fn exit_raw() -> Result(Nil, TerminalError)

Exits raw mode.

Raw mode is a mode where the terminal does not process input, but instead passes it directly to the application. This means that:

  • Input is not echoed to the screen
  • Input is not line-buffered (characters are available immediately)
  • Some special characters are not processed by the terminal
pub fn is_raw_mode() -> Bool
pub fn window_size() -> Result(#(Int, Int), TerminalError)

Returns current window size.

Search Document