etch/terminal

This module provides terminal associated functions like entering raw mode, alternative screen, setting title etc.

Types

Used in clear function.

pub type ClearType {
  All
  Purge
  FromCursorDown
  FromCursorUp
  CurrentLine
  UntilNewLine
}

Constructors

  • All

    Clears the whole screen.

  • Purge

    Clears the whole screen and the history.

  • FromCursorDown

    Clears cells from the cursor downwards.

  • FromCursorUp

    Clears cells from the cursor upwards.

  • CurrentLine

    Clears cells at the current cursor row.

  • UntilNewLine

    Clears cells from the cursor positon until the end.

Values

pub fn clear(t: ClearType) -> String

Clears the terminal. See ClearType. It is prefered not to use this directly. See Clear.

pub fn disable_line_wrap() -> String

Disable line wrap. It is prefered not to use this directly. See DisableLineWrap.

pub fn enable_line_wrap() -> String

Enable line wrap. It is prefered not to use this directly. See EnableLineWrap.

pub fn enter_alternative() -> String

Enter alternative screen. It is prefered not to use this directly. See EnterAlternative.

pub fn enter_raw() -> Nil

Enters raw mode. It is prefered not to use this directly. See EnterRaw. Exits raw mode. It is prefered not to use this directly. See EnterRaw.

pub fn exit_raw() -> Nil
pub fn is_raw_mode() -> Bool
pub fn leave_alternative() -> String

Leave alternative screen. It is prefered not to use this directly. See LeaveAlternative.

pub fn scroll_down(n: Int) -> String

Scroll N rows down. It is prefered not to use this directly. See ScrollDown.

pub fn scroll_up(n: Int) -> String

Scroll N rows up. It is prefered not to use this directly. See ScrollUp.

pub fn set_size(x: Int, y: Int) -> String

Set window size. It does not work on most modern terminals due to security issues. It is prefered not to use this directly. See SetSize.

pub fn set_title(s: String) -> String

Sets terminal title. It is prefered not to use this directly. See SetTitle.

pub fn window_size() -> #(Int, Int)

Returns current window size.

Search Document