loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / TERMINAL ALIASES FROM WEFT

TerminalOptions

Defaults enable raw mode and bracketed paste, while leaving alternate screen, clearing, cursor hiding, mouse capture, and extended keyboards off. clearScrollback permanently removes terminal history. Set only the policies your app needs.

loom.TerminalOptions is an alias for weft.TerminalOptions. It is available through import loom. The underlying type’s members are documented here.

Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.

Example

let options = TerminalOptions(alternateScreen: true, hideCursor: true, mouseCapture: true)
_ = options.bracketedPaste
Members on this page

Feature guides and release status

TerminalOptions

Type Alias
typealias TerminalOptions = weft.weft.TerminalOptions

Defaults enable raw mode and bracketed paste, while leaving alternate screen, clearing, cursor hiding, mouse capture, and extended keyboards off. clearScrollback permanently removes terminal history. Set only the policies your app needs.

Source · TerminalExports.swift:9

Underlying weft API

TerminalOptions

Structure
struct TerminalOptions

Conforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.

Terminal policies selected by an application when opening a session.

The defaults enable raw input and bracketed paste without clearing shell history, switching screens, hiding the cursor, or capturing the mouse. Extended keyboard encoding is opt-in because terminal support varies.

Source · TerminalOptions.swift:24

rawMode

Instance Property
var rawMode: Bool

Disables canonical line buffering and terminal echo for interactive input.

Source · TerminalOptions.swift:25

alternateScreen

Instance Property
var alternateScreen: Bool

Uses a separate full-screen terminal buffer.

Source · TerminalOptions.swift:26

clearScreen

Instance Property
var clearScreen: Bool

Clears the display when the session opens.

Source · TerminalOptions.swift:27

clearScrollback

Instance Property
var clearScrollback: Bool

Clears primary-screen scrollback when the session opens; history removal is permanent.

Source · TerminalOptions.swift:28

hideCursor

Instance Property
var hideCursor: Bool

Hides the cursor when opening the session.

Source · TerminalOptions.swift:29

cursorStyle

Instance Property
var cursorStyle: TerminalCursorStyle?

Nil preserves the current shape; an explicit style resets to the conventional default on close.

Source · TerminalOptions.swift:31

mouseCapture

Instance Property
var mouseCapture: Bool

Requests mouse tracking on session open.

Source · TerminalOptions.swift:32

bracketedPaste

Instance Property
var bracketedPaste: Bool

Requests separately delimited paste events.

Source · TerminalOptions.swift:33

focusReporting

Instance Property
var focusReporting: Bool

Request terminal focus reports (DEC private mode 1004).

Disabled by default.

Source · TerminalOptions.swift:37

colorSchemeReporting

Instance Property
var colorSchemeReporting: Bool

Opt into Contour color-scheme change notifications (DEC private mode 2031).

Source · TerminalOptions.swift:39

keyboardProtocol

Instance Property
var keyboardProtocol: TerminalKeyboardProtocol

Requested keyboard encoding policy.

Source · TerminalOptions.swift:40

maximumPasteBytes

Instance Property
var maximumPasteBytes: Int

Maximum UTF-8 bytes retained in a bracketed paste; defaults to 1 MiB.

Source · TerminalOptions.swift:42

escapeTimeoutMilliseconds

Instance Property
var escapeTimeoutMilliseconds: Int

Idle milliseconds before a lone legacy Escape becomes a key; defaults to 35.

Shared by polling and asynchronous events. Zero resolves Escape immediately; use a longer delay for fragmented input over remote links. Values are clamped to 0...Int32.max when used. Raw-byte input is unaffected.

Source · TerminalOptions.swift:48

init(rawMode:alternateScreen:clearScreen:clearScrollback:hideCursor:cursorStyle:mouseCapture:bracketedPaste:focusReporting:colorSchemeReporting:keyboardProtocol:maximumPasteBytes:escapeTimeoutMilliseconds:)

Initializer
init(rawMode: Bool = true, alternateScreen: Bool = false, clearScreen: Bool = false, clearScrollback: Bool = false, hideCursor: Bool = false, cursorStyle: TerminalCursorStyle? = nil, mouseCapture: Bool = false, bracketedPaste: Bool = true, focusReporting: Bool = false, colorSchemeReporting: Bool = false, keyboardProtocol: TerminalKeyboardProtocol = .legacy, maximumPasteBytes: Int = 1_048_576, escapeTimeoutMilliseconds: Int = 35)

Creates a value with the supplied arguments. Default arguments are shown in the declaration.

Parameters (13)
rawMode
Argument type and any default are shown in the declaration; see the behavior notes above.
alternateScreen
Argument type and any default are shown in the declaration; see the behavior notes above.
clearScreen
Argument type and any default are shown in the declaration; see the behavior notes above.
clearScrollback
Argument type and any default are shown in the declaration; see the behavior notes above.
hideCursor
Argument type and any default are shown in the declaration; see the behavior notes above.
cursorStyle
Argument type and any default are shown in the declaration; see the behavior notes above.
mouseCapture
Argument type and any default are shown in the declaration; see the behavior notes above.
bracketedPaste
Argument type and any default are shown in the declaration; see the behavior notes above.
focusReporting
Argument type and any default are shown in the declaration; see the behavior notes above.
colorSchemeReporting
Argument type and any default are shown in the declaration; see the behavior notes above.
keyboardProtocol
Argument type and any default are shown in the declaration; see the behavior notes above.
maximumPasteBytes
Argument type and any default are shown in the declaration; see the behavior notes above.
escapeTimeoutMilliseconds
Argument type and any default are shown in the declaration; see the behavior notes above.
Source · TerminalOptions.swift:50