etch/erlang/tty

Types

pub type TerminalError {
  CouldNotGetWindowSize
  FailedToEnterRawMode
  FailedToExitRawMode
}

Constructors

  • CouldNotGetWindowSize
  • FailedToEnterRawMode
  • FailedToExitRawMode

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