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
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
ColorsandAttributes. -
Println(s: String)Prints text and moves the caret to the beginning of a new line.
-
PrintlnReset(s: String)Prints text, resets its
ColorsandAttributesand 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.
-
SavePositionSaves cursor position.
-
RestorePositionRestores cursor position.
-
ShowCursorShows cursor.
-
HideCursorHides 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.
-
DisableLineWrapDisables line wrap.
-
EnableLineWrapEnables line wrap.
-
EnterRawEnters raw mode.
-
EnterAlternateScreenEnters 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.
-
LeaveAlternateScreenLeaves 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.
-
EnableMouseCaptureEnables mouse capture. See
event -
DisableMouseCaptureDisables mouse capture. See
event -
PushKeyboardEnhancementFlags( flags: List(event.KeyboardEnhancementFlag), )Pushes keyboard enhancement flags. See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
-
PopKeyboardEnhancementFlagsPops keyboard enhancement flags. See https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
-
EnableFocusChangeEnables focus change. See
event -
DisableFocusChangeDisables focus change. See
event -
SetForegroundColor(fg: style.Color)Sets foreground
Color. UsingSetForegroundAndBackgroundColorsis prefered to set both the background and foreground colors. -
SetBackgroundColor(bg: style.Color)Sets background
Color. UsingSetForegroundAndBackgroundColorsis 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 -
ResetStyleResets
Attributesand foreground and backgroundColors. -
ResetColorResets foreground and background
Colors. -
ResetForegroundResets foreground
Colors. -
ResetBackgroundResets foreground
Colors. -
SetAttributes(attrs: List(style.Attribute))Sets
Attributes. -
ResetAttributesResets
Attributes.