28inline constexpr Modifier SHIFT = Modifier::SHIFT;
29inline constexpr Modifier ALT = Modifier::ALT;
30inline constexpr Modifier CTRL = Modifier::CTRL;
43 constexpr bool has(key::Modifier modifier)
const noexcept {
45 case key::Modifier::SHIFT:
47 case key::Modifier::ALT:
49 case key::Modifier::CTRL:
106constexpr Chord operator+(Modifier modifier, Chord chord)
noexcept {
108 case Modifier::SHIFT:
109 chord.modifiers.shift =
true;
112 chord.modifiers.alt =
true;
115 chord.modifiers.control =
true;
126constexpr InputModifiers operator+(Modifier first, Modifier second)
noexcept {
127 return (first + (second +
Chord{})).modifiers;
134constexpr Chord operator+(InputModifiers modifiers,
Chord chord)
noexcept {
135 chord.modifiers.shift = chord.modifiers.shift || modifiers.shift;
136 chord.modifiers.alt = chord.modifiers.alt || modifiers.alt;
137 chord.modifiers.control = chord.modifiers.control || modifiers.control;
138 chord.modifiers.super = chord.modifiers.super || modifiers.super;
147constexpr InputModifiers operator+(InputModifiers modifiers, Modifier modifier)
noexcept {
148 return (modifiers + (modifier +
Chord{})).modifiers;
379 std::variant<KeyEvent, TextInputEvent, MouseInputEvent, PasteInputEvent, InputProbeCandidate, InputIssue>;
495 [[nodiscard]] std::expected<InputStep, InputError>
next(std::string_view bytes,
InputTime now);
507 [[nodiscard]] std::optional<InputTime>
deadline() const noexcept;
542 std::expected<InputStep, InputError> pull(std::string_view bytes,
InputTime now,
bool ending);
543 std::optional<InputEvent> byte(
unsigned char value,
bool &consume,
InputTime now,
544 std::optional<InputProtocolEvent> &protocol);
545 std::optional<InputEvent> ground(
unsigned char value,
bool alt,
InputTime now);
546 std::optional<InputEvent> control(
unsigned char value,
InputTime now, std::optional<InputProtocolEvent> &protocol);
547 std::optional<InputEvent> sequence(
InputTime now, std::optional<InputProtocolEvent> &protocol);
548 std::optional<InputEvent> paste(
unsigned char value);
549 std::optional<InputEvent> expire(
InputTime now);
552 bool sizeReportCandidate() const noexcept;
554 void clearSequence() noexcept;
556 InputOptions options_;
557 InputPointerContext pointerContext_, sequencePointerContext_;
558 State state_{State::GROUND};
559 std::optional<InputTime> last_time_;
562 std::uint64_t offset_{};
563 std::uint64_t start_{};
564 std::array<char, 64> sequence_{};
565 std::size_t length_{};
566 bool intermediate_{};
568 bool string_escape_{};
570 char32_t minimum_scalar_{};
571 unsigned remaining_{};
574 std::unique_ptr<std::string> paste_;
575 std::size_t marker_{};
576 InputProbeWindow window_;
577 std::optional<InputEvent> pending_;
Public Portals API.
Definition action.hpp:8
InputProbeKind
Supported syntactic reply kinds, not proof of terminal identity.
Definition input.hpp:322
@ PRIMARY_DEVICE_ATTRIBUTES
Primary device attributes reply; values contain its numeric parameters.
Definition input.hpp:323
@ CURSOR_POSITION
Cursor position reply; values contain the one-based row followed by column.
Definition input.hpp:324
@ PASTE
Paste category without clipboard or payload.
Definition diagnostics.hpp:65
@ TRUNCATED
Physical EOF arrived before the complete member trailer.
Definition gzip_document.hpp:15
@ WORK_LIMIT
The input admission budget was reached.
Definition document_encoding.hpp:36
@ NEED_INPUT
More input is needed to continue.
Definition document_encoding.hpp:34
KeyAction
Native adapters may report repeat/release; VT emits press only.
Definition input.hpp:206
@ REPEAT
Repeated key press reported by a native adapter.
Definition input.hpp:208
@ RELEASE
Key release reported by a native adapter.
Definition input.hpp:209
@ PRESS
Key press; the only action emitted by the VT decoder.
Definition input.hpp:207
InputCoordinateMode
SGR coordinate interpretation selected only at a proven stream boundary.
Definition input.hpp:273
@ PIXEL
1016 pixel coordinates; usable dimensions are required.
Definition input.hpp:275
@ CELL
Traditional 1006 character coordinates.
Definition input.hpp:274
@ FAILED
The coroutine returned an error or threw.
Definition async.hpp:46
MouseAction
Motion and wheel are separate from button transitions.
Definition input.hpp:249
@ SCROLL
Wheel movement in the direction given by MouseInputEvent::button.
Definition input.hpp:253
@ MOVE
Pointer motion, with a reported button or MouseButton::NO_BUTTON.
Definition input.hpp:252
InputStatus
Why a pull stopped; deliver its event or report before calling again.
Definition input.hpp:419
@ EVENT
One event is ready; deliver it before resubmitting the unconsumed suffix.
Definition input.hpp:420
@ FINISHED
End-of-stream flushing is complete; this step may still contain the final event.
Definition input.hpp:423
@ PROTOCOL
One protocol report is ready; handle it before resubmitting the unconsumed suffix.
Definition input.hpp:425
std::variant< KeyEvent, TextInputEvent, MouseInputEvent, PasteInputEvent, InputProbeCandidate, InputIssue > InputEvent
Independent owning result, usable beyond decoder reset/destruction.
Definition input.hpp:378
@ INVALID_OPTIONS
Runner options are invalid, or a native run was requested with an injected clock.
Definition application.hpp:31
@ CLOSED
Owner, node scope, scheduler or completion endpoint is closed.
Definition async.hpp:28
@ OFFSET_OVERFLOW
The offset after consumed input cannot fit in uint64_t.
Definition document_hex.hpp:28
std::variant< InputSizeReport, InputModeReport > InputProtocolEvent
Terminal protocol data kept separate from user input and single-use probe windows.
Definition input.hpp:416
InputError
Construction and call errors, separate from events caused by input bytes.
Definition input.hpp:382
@ INVALID_WINDOW
Reply interval is empty/reversed, or the decoder is not at an open, idle boundary.
Definition input.hpp:388
@ BACKWARD_TIME
The supplied timestamp precedes the last accepted next() or finish() timestamp.
Definition input.hpp:384
InputIssueKind
Recoverable decode issues; timeout may also leave the decoder failed.
Definition input.hpp:350
@ TIMEOUT
Control sequence, control string or paste reached its deadline; reset is required.
Definition input.hpp:359
@ PARAMETER_LIMIT
Parameter count or decimal field length exceeds max_parameters or max_digits.
Definition input.hpp:356
@ PASTE_LIMIT
Paste payload exceeds max_paste_bytes; no partial paste event is delivered.
Definition input.hpp:358
@ UNKNOWN_SEQUENCE
Unsupported control sequence, including disabled features or unexpected replies.
Definition input.hpp:353
@ NUMERIC_OVERFLOW
A decimal parameter cannot be represented as a uint32_t value.
Definition input.hpp:357
@ INVALID_SEQUENCE
Malformed control syntax or invalid SGR mouse parameters.
Definition input.hpp:354
@ SEQUENCE_LIMIT
CSI or SS3 sequence exceeds InputOptions::max_sequence_bytes.
Definition input.hpp:355
MouseButton
SGR button identity; NO_BUTTON is used for unbuttoned motion.
Definition input.hpp:237
@ WHEEL_UP
Vertical wheel movement upward.
Definition input.hpp:242
@ WHEEL_DOWN
Vertical wheel movement downward.
Definition input.hpp:243
@ MIDDLE
Middle mouse button.
Definition input.hpp:239
@ WHEEL_RIGHT
Horizontal wheel movement rightward.
Definition input.hpp:245
@ WHEEL_LEFT
Horizontal wheel movement leftward.
Definition input.hpp:244
@ NO_BUTTON
Motion reported without a pressed button.
Definition input.hpp:241
std::uint64_t InputTime
Caller-supplied monotonic milliseconds; no wall clock or I/O is used.
Definition input.hpp:19
@ INVALID_UTF8
Invalid UTF-8 sequence anywhere in strict input.
Definition pss_data.hpp:162
InputKey
Semantic key identities; character uses KeyEvent::scalar.
Definition input.hpp:64
@ F6
Function key F6.
Definition input.hpp:85
@ RIGHT
Right arrow key.
Definition input.hpp:72
@ ENTER
Enter key; the VT profile maps carriage return to this identity.
Definition input.hpp:67
@ F5
Function key F5.
Definition input.hpp:84
@ CHARACTER
Character key identified by KeyEvent::scalar; VT uses this for control combinations.
Definition input.hpp:65
@ F7
Function key F7.
Definition input.hpp:86
@ F8
Function key F8.
Definition input.hpp:87
@ F3
Function key F3.
Definition input.hpp:82
@ INSERT
Insert key.
Definition input.hpp:76
@ F11
Function key F11.
Definition input.hpp:90
@ LEFT
Left arrow key.
Definition input.hpp:73
@ BACKSPACE
Backspace key; the VT profile accepts both BS and DEL bytes.
Definition input.hpp:69
@ HOME
Home navigation key.
Definition input.hpp:74
@ F9
Function key F9.
Definition input.hpp:88
@ END
End navigation key.
Definition input.hpp:75
@ F10
Function key F10.
Definition input.hpp:89
@ DOWN
Down arrow key.
Definition input.hpp:71
@ DELETE_KEY
Delete key, distinct from the DEL byte decoded as Backspace.
Definition input.hpp:77
@ ESCAPE
Escape key, including a standalone ESC resolved by timeout or end of input.
Definition input.hpp:66
@ F1
Function key F1.
Definition input.hpp:80
@ PAGE_UP
Page Up navigation key.
Definition input.hpp:78
@ F4
Function key F4.
Definition input.hpp:83
@ F12
Function key F12.
Definition input.hpp:91
@ PAGE_DOWN
Page Down navigation key.
Definition input.hpp:79
@ TAB
Tab key; modifiers distinguish Shift+Tab.
Definition input.hpp:68
@ UP
Up arrow key.
Definition input.hpp:70
@ F2
Function key F2.
Definition input.hpp:81
@ UTF8
UTF-8.
Definition document_encoding.hpp:16
@ STRING
SQL literal or literal Markdown code region.
Definition document_highlight_types.hpp:56
Owning decoder context; validity changes are ordered by the caller.
Definition input.hpp:279
std::uint32_t text_width_px
Positive text-area pixel width, or zero if unavailable.
Definition input.hpp:283
std::uint32_t text_height_px
Positive text-area pixel height, or zero if unavailable.
Definition input.hpp:284
std::uint64_t generation
Caller-owned generation, independent of probe windows.
Definition input.hpp:285
std::uint32_t rows
Positive character height, or zero if unavailable.
Definition input.hpp:282
bool operator==(const InputPointerContext &other) const =default
Compare the complete coordinate interpretation.
std::uint32_t columns
Positive character width, or zero if unavailable.
Definition input.hpp:281
InputCoordinateMode mode
Wire coordinate units.
Definition input.hpp:280
Owning key value without an inferred physical keyboard scan code.
Definition input.hpp:213
bool operator==(const KeyEvent &other) const =default
Compare the complete event value.
InputKey key
Semantic identity.
Definition input.hpp:214
InputModifiers modifiers
Observed modifiers.
Definition input.hpp:216
KeyAction action
Observed action; VT does not infer held state.
Definition input.hpp:217
char32_t scalar
Character for control combinations, otherwise zero.
Definition input.hpp:215
One Unicode scalar, not a grapheme cluster; Alt may be present.
Definition input.hpp:226
char32_t scalar
Valid Unicode scalar, without normalization.
Definition input.hpp:227
InputModifiers modifiers
Observed modifiers.
Definition input.hpp:228
bool operator==(const TextInputEvent &other) const =default
Compare the complete event value.
Compile-time semantic shortcut; letters match ASCII case with exact modifiers.
Definition input.hpp:96
InputModifiers modifiers
Exact observed semantic modifiers.
Definition input.hpp:99
char32_t scalar
ASCII character identity, zero for named keys.
Definition input.hpp:98
InputKey key
Semantic key identity.
Definition input.hpp:97