loom & weft
Made for Swift.

Published release 0.2.1. Unreleased PR #2 reference.

LOOM 0.2.1 / TERMINAL ALIASES FROM WEFT

InputEvent

Events distinguish typed text, pasted text, keyboard phases/modifiers, mouse input, resizing, and termination signals. keyboardEvent normalizes legacy .key and extended .keyEvent, plus .text containing exactly one character; multi-character text is not normalized.

loom.InputEvent is an alias for weft.InputEvent. 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 event = InputEvent.text("ab")
switch event {
case let .text(text): for character in text { _ = character }
case let .resize(width, height): _ = (width, height)
default: _ = event.keyboardEvent
}
Members on this page

Feature guides and release status

InputEvent

Type Alias
typealias InputEvent = weft.weft.InputEvent

Events distinguish typed text, pasted text, keyboard phases/modifiers, mouse input, resizing, and termination signals. keyboardEvent normalizes legacy .key and extended .keyEvent, plus .text containing exactly one character; multi-character text is not normalized.

Source · TerminalExports.swift:19

Underlying weft API

InputEvent

Enumeration
enum InputEvent

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

Input from the terminal or a change to the terminal session.

Source · InputEvent.swift:2

key(_:)

Case
case key(Key)

The key case. Associated values, if any, are shown in the declaration.

Source · InputEvent.swift:3

keyEvent(_:)

Case
case keyEvent(KeyEvent)

The key event case. Associated values, if any, are shown in the declaration.

Source · InputEvent.swift:4

text(_:)

Case
case text(String)

Typed text that can contain several characters in one read. Iterate its characters when interpreting key bindings.

Source · InputEvent.swift:5

paste(_:)

Case
case paste(String)

Bracketed-paste text. Treat as inserted content rather than command keystrokes.

Source · InputEvent.swift:6

pasteTruncated(_:)

Case
case pasteTruncated(String)

A bracketed paste exceeded the byte budget; only this prefix was retained.

Source · InputEvent.swift:8

mouse(_:)

Case
case mouse(MouseEvent)

The mouse case. Associated values, if any, are shown in the declaration.

Source · InputEvent.swift:9

focusChanged(_:)

Case
case focusChanged(Bool)

A terminal focus report: true on focus gain, false on focus loss.

Source · InputEvent.swift:11

resize(_:_:)

Case
case resize(Int, Int)

New terminal width and height in cells. Resize the renderer and reflow cached layouts before drawing.

Source · InputEvent.swift:12

signal(_:)

Case
case signal(Int)

POSIX signal number. Decide how to exit or react, and retain deferred session cleanup.

Source · InputEvent.swift:13

queryResult(_:)

Case
case queryResult(TerminalQueryResult)

A requested query completed through the same reader as keyboard input.

Source · InputEvent.swift:15

terminalReply(_:)

Case
case terminalReply(TerminalReply)

A recognized report; sessions opt into unsolicited color-scheme updates.

Source · InputEvent.swift:17

terminalResumed

Case
case terminalResumed

Terminal ownership was reacquired; applications should redraw their interface.

Source · InputEvent.swift:19

keyboardEvent

Instance Property
var keyboardEvent: KeyEvent? { get }

A uniform keyboard view of legacy and extended input events.

Source · InputEvent.swift:24