etch/command

This module provides commads to be queued and flushed.

import stdout.{Queue, queue, flush}

let q = Queue([])
queue(q, [
  EnterRaw,
  EnterAlternativeScreen,
  HideCursor,
  Println("Hello from Etch"),
])
flush(q)

Types

Commands can be queued and flushed afterwards. See Queue, flush and execute functions.

pub type Command {
  Print(s: String)
  PrintReset(s: String)
  Println(s: String)
  PrintlnReset(s: String)
  MoveUp(n: Int)
  MoveDown(n: Int)
  MoveLeft(n: Int)
  MoveRight(n: Int)
  MoveToNextLine(n: Int)
  MoveToPreviousLine(n: Int)
  MoveToColumn(n: Int)
  MoveToRow(n: Int)
  MoveTo(column: Int, row: Int)
  SavePosition
  RestorePosition
  ShowCursor
  HideCursor
  SetCursorStyle(style: cursor.CursorStyle)
  ScrollUp(n: Int)
  ScrollDown(n: Int)
  Clear(clear_type: terminal.ClearType)
  SetSize(columns: Int, rows: Int)
  SetTitle(title: String)
  DisableLineWrap
  EnableLineWrap
  EnterRaw
  EnterAlternateScreen
  LeaveAlternateScreen
  EnableMouseCapture
  DisableMouseCapture
  PushKeyboardEnhancementFlags(
    flags: List(event.KeyboardEnhancementFlag),
  )
  PopKeyboardEnhancementFlags
  EnableFocusChange
  DisableFocusChange
  SetForegroundColor(fg: style.Color)
  SetBackgroundColor(bg: style.Color)
  SetForegroundAndBackgroundColors(
    fg: style.Color,
    bg: style.Color,
  )
  SetStyle(style: style.Style)
  ResetStyle
  ResetColor
  ResetForeground
  ResetBackground
  SetAttributes(attrs: List(style.Attribute))
  ResetAttributes
}

Constructors

  • Print(s: String)

    Prints text.

  • PrintReset(s: String)

    Prints text and resets its Colors and Attributes.

  • Println(s: String)

    Prints text and moves the caret to the beginning of a new line.

  • PrintlnReset(s: String)

    Prints text, resets its Colors and Attributes and moves the caret to the beginning of a new line.

  • MoveUp(n: Int)

    Moves the cursor n lines up.

  • MoveDown(n: Int)

    Moves the cursor n lines down.

  • MoveLeft(n: Int)

    Moves the cursor n characters left.

  • MoveRight(n: Int)

    Moves the cursor n characters right.

  • MoveToNextLine(n: Int)

    Moves the cursor n lines down and moves the caret to the beginning of the line.

  • MoveToPreviousLine(n: Int)

    Moves the cursor n lines up and moves the caret to the beginning of the line.

  • MoveToColumn(n: Int)

    Moves the cursor to the given column while the row remains the same.

  • MoveToRow(n: Int)

    Moves the cursor to the given row while the column remains the same.

  • MoveTo(column: Int, row: Int)

    Moves the cursor to the given row and column.

  • SavePosition

    Saves cursor position.

  • RestorePosition

    Restores cursor position.

  • ShowCursor

    Shows cursor.

  • HideCursor

    Hides cursor.

  • SetCursorStyle(style: cursor.CursorStyle)

    Sets cursor style. See CursorStyle.

  • ScrollUp(n: Int)

    Scrolls the terminal n lines up.

  • ScrollDown(n: Int)

    Scrolls the terminal n lines down.

  • Clear(clear_type: terminal.ClearType)

    Clears the terminal. See ClearType.

  • SetSize(columns: Int, rows: Int)

    Sets terminal size.

  • SetTitle(title: String)

    Sets terminal title.

  • DisableLineWrap

    Disables line wrap.

  • EnableLineWrap

    Enables line wrap.

  • EnterRaw

    Enters raw mode.

  • EnterAlternateScreen

    Enters the alternate screen. Working in the alternate screen will not affect the main screen buffer. A good example of using an alternate screen is Vim.

  • LeaveAlternateScreen

    Leaves the alternate screen. Working in the alternate screen will not affect the main screen buffer. A good example of using an alternate screen is Vim.

  • EnableMouseCapture

    Enables mouse capture. See event

  • DisableMouseCapture

    Disables mouse capture. See event

  • PushKeyboardEnhancementFlags(
      flags: List(event.KeyboardEnhancementFlag),
    )

    Pushes keyboard enhancement flags. See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement

  • PopKeyboardEnhancementFlags

    Pops keyboard enhancement flags. See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement

  • EnableFocusChange

    Enables focus change. See event

  • DisableFocusChange

    Disables focus change. See event

  • SetForegroundColor(fg: style.Color)

    Sets foreground Color. Using SetForegroundAndBackgroundColors is prefered to set both the background and foreground colors.

  • SetBackgroundColor(bg: style.Color)

    Sets background Color. Using SetForegroundAndBackgroundColors is prefered to set both the background and foreground colors.

  • SetForegroundAndBackgroundColors(
      fg: style.Color,
      bg: style.Color,
    )

    Sets foreground and background Colors. Using this is prefered to set both the background and foreground colors.

  • SetStyle(style: style.Style)

    Sets Style

  • ResetStyle

    Resets Attributes and foreground and background Colors.

  • ResetColor

    Resets foreground and background Colors.

  • ResetForeground

    Resets foreground Colors.

  • ResetBackground

    Resets foreground Colors.

  • SetAttributes(attrs: List(style.Attribute))

    Sets Attributes.

  • ResetAttributes

    Resets Attributes.

Search Document