Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / TERMINAL ALIASES FROM WEFT
KeyEvent
Separates the logical key, modifier bits, press/repeat/release phase, produced text, shifted key, and base-layout key. Optional layout/text fields depend on terminal protocol support. Ignore .release when your app acts only on key presses.
loom.KeyEvent is an alias for weft.KeyEvent. 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 = KeyEvent(key: .character("c"), modifiers: [.control])
_ = event.kind != .release && event.modifiers.contains(.control)Members on this page
Feature guides and release status
KeyEvent
typealias KeyEvent = weft.weft.KeyEventSeparates the logical key, modifier bits, press/repeat/release phase, produced text, shifted key, and base-layout key. Optional layout/text fields depend on terminal protocol support. Ignore .release when your app acts only on key presses.
Source · TerminalExports.swift:14Underlying weft API
KeyEvent
struct KeyEventConforms to: Swift.Equatable, Swift.Sendable, Swift.SendableMetatype.
A key with modifiers and an optional repeat/release phase.
Source · KeyEvent.swift:27key
let key: KeyThe logical key identity.
Source · KeyEvent.swift:28modifiers
let modifiers: KeyModifiersModifier and lock bits supplied by the terminal.
Source · KeyEvent.swift:29kind
let kind: KeyEventKindThe event’s keyboard phase or mouse action.
Source · KeyEvent.swift:30text
let text: String?Text produced by the key, when supplied by the terminal.
Source · KeyEvent.swift:32shiftedKey
let shiftedKey: Key?The shifted key in the current keyboard layout, when reported.
Source · KeyEvent.swift:34baseLayoutKey
let baseLayoutKey: Key?The physical key in the standard layout, useful for matching shortcuts.
Source · KeyEvent.swift:36init(key:modifiers:kind:text:shiftedKey:baseLayoutKey:)
init(key: Key, modifiers: KeyModifiers = [], kind: KeyEventKind = .press, text: String? = nil, shiftedKey: Key? = nil, baseLayoutKey: Key? = nil)Creates a value with the supplied arguments. Default arguments are shown in the declaration.
Parameters (6)
key- Logical key to handle.
modifiers- Argument type and any default are shown in the declaration; see the behavior notes above.
kind- Argument type and any default are shown in the declaration; see the behavior notes above.
text- Source text.
shiftedKey- Argument type and any default are shown in the declaration; see the behavior notes above.
baseLayoutKey- Argument type and any default are shown in the declaration; see the behavior notes above.