Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
input.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3
4#pragma once
5
6#include <array>
7#include <cstddef>
8#include <cstdint>
9#include <expected>
10#include <memory>
11#include <optional>
12#include <string>
13#include <string_view>
14#include <variant>
15
16namespace portals {
17
19using InputTime = std::uint64_t;
20
21namespace key {
23enum class Modifier {
24 SHIFT,
25 ALT,
26 CTRL
27};
28inline constexpr Modifier SHIFT = Modifier::SHIFT;
29inline constexpr Modifier ALT = Modifier::ALT;
30inline constexpr Modifier CTRL = Modifier::CTRL;
31} // namespace key
32
35 bool shift{};
36 bool alt{};
37 bool control{};
38 bool super{};
39
43 constexpr bool has(key::Modifier modifier) const noexcept {
44 switch (modifier) {
45 case key::Modifier::SHIFT:
46 return shift;
47 case key::Modifier::ALT:
48 return alt;
49 case key::Modifier::CTRL:
50 return control;
51 }
52
53 return false;
54 }
55
60 bool operator==(const InputModifiers &other) const = default;
61};
62
64enum class InputKey {
66 ESCAPE,
67 ENTER,
68 TAB,
69 BACKSPACE,
70 UP,
71 DOWN,
72 RIGHT,
73 LEFT,
74 HOME,
75 END,
76 INSERT,
77 DELETE_KEY,
78 PAGE_UP,
79 PAGE_DOWN,
80 F1,
81 F2,
82 F3,
83 F4,
84 F5,
85 F6,
86 F7,
87 F8,
88 F9,
89 F10,
90 F11,
91 F12
92};
93
94namespace key {
96struct Chord {
98 char32_t scalar{};
100};
101
106constexpr Chord operator+(Modifier modifier, Chord chord) noexcept {
107 switch (modifier) {
108 case Modifier::SHIFT:
109 chord.modifiers.shift = true;
110 break;
111 case Modifier::ALT:
112 chord.modifiers.alt = true;
113 break;
114 case Modifier::CTRL:
115 chord.modifiers.control = true;
116 break;
117 }
118
119 return chord;
120}
121
126constexpr InputModifiers operator+(Modifier first, Modifier second) noexcept {
127 return (first + (second + Chord{})).modifiers;
128}
129
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;
139
140 return chord;
141}
142
147constexpr InputModifiers operator+(InputModifiers modifiers, Modifier modifier) noexcept {
148 return (modifiers + (modifier + Chord{})).modifiers;
149}
150
151inline constexpr Chord ESCAPE{InputKey::ESCAPE};
152inline constexpr Chord ENTER{InputKey::ENTER};
153inline constexpr Chord TAB{InputKey::TAB};
154inline constexpr Chord BACKSPACE{InputKey::BACKSPACE};
155inline constexpr Chord UP{InputKey::UP};
156inline constexpr Chord DOWN{InputKey::DOWN};
157inline constexpr Chord RIGHT{InputKey::RIGHT};
158inline constexpr Chord LEFT{InputKey::LEFT};
159inline constexpr Chord HOME{InputKey::HOME};
160inline constexpr Chord END{InputKey::END};
161inline constexpr Chord INSERT{InputKey::INSERT};
162inline constexpr Chord DELETE_KEY{InputKey::DELETE_KEY};
163inline constexpr Chord PAGE_UP{InputKey::PAGE_UP};
164inline constexpr Chord PAGE_DOWN{InputKey::PAGE_DOWN};
165inline constexpr Chord F1{InputKey::F1};
166inline constexpr Chord F2{InputKey::F2};
167inline constexpr Chord F3{InputKey::F3};
168inline constexpr Chord F4{InputKey::F4};
169inline constexpr Chord F5{InputKey::F5};
170inline constexpr Chord F6{InputKey::F6};
171inline constexpr Chord F7{InputKey::F7};
172inline constexpr Chord F8{InputKey::F8};
173inline constexpr Chord F9{InputKey::F9};
174inline constexpr Chord F10{InputKey::F10};
175inline constexpr Chord F11{InputKey::F11};
176inline constexpr Chord F12{InputKey::F12};
177inline constexpr Chord A{InputKey::CHARACTER, U'A'};
178inline constexpr Chord B{InputKey::CHARACTER, U'B'};
179inline constexpr Chord C{InputKey::CHARACTER, U'C'};
180inline constexpr Chord D{InputKey::CHARACTER, U'D'};
181inline constexpr Chord E{InputKey::CHARACTER, U'E'};
182inline constexpr Chord F{InputKey::CHARACTER, U'F'};
183inline constexpr Chord G{InputKey::CHARACTER, U'G'};
184inline constexpr Chord H{InputKey::CHARACTER, U'H'};
185inline constexpr Chord I{InputKey::CHARACTER, U'I'};
186inline constexpr Chord J{InputKey::CHARACTER, U'J'};
187inline constexpr Chord K{InputKey::CHARACTER, U'K'};
188inline constexpr Chord L{InputKey::CHARACTER, U'L'};
189inline constexpr Chord M{InputKey::CHARACTER, U'M'};
190inline constexpr Chord N{InputKey::CHARACTER, U'N'};
191inline constexpr Chord O{InputKey::CHARACTER, U'O'};
192inline constexpr Chord P{InputKey::CHARACTER, U'P'};
193inline constexpr Chord Q{InputKey::CHARACTER, U'Q'};
194inline constexpr Chord R{InputKey::CHARACTER, U'R'};
195inline constexpr Chord S{InputKey::CHARACTER, U'S'};
196inline constexpr Chord T{InputKey::CHARACTER, U'T'};
197inline constexpr Chord U{InputKey::CHARACTER, U'U'};
198inline constexpr Chord V{InputKey::CHARACTER, U'V'};
199inline constexpr Chord W{InputKey::CHARACTER, U'W'};
200inline constexpr Chord X{InputKey::CHARACTER, U'X'};
201inline constexpr Chord Y{InputKey::CHARACTER, U'Y'};
202inline constexpr Chord Z{InputKey::CHARACTER, U'Z'};
203} // namespace key
204
211
213struct KeyEvent {
215 char32_t scalar{};
222 bool operator==(const KeyEvent &other) const = default;
223};
224
227 char32_t scalar{};
233 bool operator==(const TextInputEvent &other) const = default;
234};
235
247
255
258 std::uint32_t x{};
259 std::uint32_t y{};
260 std::uint32_t columns{};
261 std::uint32_t rows{};
262 std::uint32_t text_width_px{};
263 std::uint32_t text_height_px{};
264 std::uint64_t generation{};
269 bool operator==(const InputPointerPrecision &other) const = default;
270};
271
277
281 std::uint32_t columns{};
282 std::uint32_t rows{};
283 std::uint32_t text_width_px{};
284 std::uint32_t text_height_px{};
285 std::uint64_t generation{};
290 bool operator==(const InputPointerContext &other) const = default;
291};
292
295 std::int32_t column{};
296 std::int32_t row{};
300 std::optional<InputPointerPrecision> precision{};
301 double wheelDelta{1.0};
306 bool operator==(const MouseInputEvent &other) const = default;
307};
308
313 std::string bytes;
318 bool operator==(const PasteInputEvent &other) const = default;
319};
320
326
335
339 std::uint64_t generation{};
340 std::array<std::uint32_t, 16> values{};
341 std::size_t count{};
346 bool operator==(const InputProbeCandidate &other) const = default;
347};
348
361
367 std::uint64_t begin{};
368 std::uint64_t end{};
374 bool operator==(const InputIssue &other) const = default;
375};
376
379 std::variant<KeyEvent, TextInputEvent, MouseInputEvent, PasteInputEvent, InputProbeCandidate, InputIssue>;
380
390
393 std::uint32_t rows{};
394 std::uint32_t columns{};
395 std::uint32_t text_height_px{};
396 std::uint32_t text_width_px{};
401 bool operator==(const InputSizeReport &other) const = default;
402};
403
406 std::uint32_t mode{};
407 std::uint32_t state{};
412 bool operator==(const InputModeReport &other) const = default;
413};
414
416using InputProtocolEvent = std::variant<InputSizeReport, InputModeReport>;
417
427
429struct InputStep {
430 std::size_t consumed{};
431 std::optional<InputEvent> event;
433 std::optional<InputProtocolEvent> protocol{};
434};
435
438 std::size_t max_sequence_bytes{64};
439 std::size_t max_parameters{16};
440 std::size_t max_digits{10};
441 std::size_t max_paste_bytes{1024 * 1024};
442 std::size_t work_bytes{4096};
446 bool sgr_mouse{true};
447 bool bracketed_paste{true};
448 bool terminal_reports{false};
449 // CSI 48 requires four primary dimensions; ignored colon slots retain all resource bounds.
450};
451
466public:
471 [[nodiscard]] static std::expected<InputDecoder, InputError> create(InputOptions options = {});
472 InputDecoder(const InputDecoder &) = delete;
477 InputDecoder(InputDecoder &&other) noexcept = default;
482 InputDecoder &operator=(InputDecoder &&other) noexcept = default;
483
495 [[nodiscard]] std::expected<InputStep, InputError> next(std::string_view bytes, InputTime now);
502 [[nodiscard]] std::expected<InputStep, InputError> finish(InputTime now);
507 [[nodiscard]] std::optional<InputTime> deadline() const noexcept;
514 [[nodiscard]] std::expected<void, InputError> expectReplies(InputProbeWindow window) noexcept;
523 void reset() noexcept;
524
525private:
526 enum class State {
527 GROUND,
528 ESCAPE,
529 UTF8,
530 CSI,
531 SS3,
532 DISCARD_CSI,
533 STRING,
534 PASTE,
535 DISCARD_PASTE,
536 FAILED
537 };
538
539 explicit InputDecoder(InputOptions options) : options_(options) {
540 }
541
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);
550 InputIssue issue(InputIssueKind kind) const noexcept;
551 InputIssue sequenceIssue(InputIssueKind kind) const noexcept;
552 bool sizeReportCandidate() const noexcept;
553 void begin(State state, InputTime now, InputTime duration) noexcept;
554 void clearSequence() noexcept;
555
556 InputOptions options_;
557 InputPointerContext pointerContext_, sequencePointerContext_;
558 State state_{State::GROUND};
559 std::optional<InputTime> last_time_;
560 InputTime deadline_{};
561 InputTime sequence_started_{};
562 std::uint64_t offset_{};
563 std::uint64_t start_{};
564 std::array<char, 64> sequence_{};
565 std::size_t length_{};
566 bool intermediate_{};
567 bool string_osc_{};
568 bool string_escape_{};
569 char32_t scalar_{};
570 char32_t minimum_scalar_{};
571 unsigned remaining_{};
572 bool alt_{};
573 // Allocate paste storage only under pull's checked allocation boundary; create/move/reset stay allocation-free.
574 std::unique_ptr<std::string> paste_;
575 std::size_t marker_{};
576 InputProbeWindow window_;
577 std::optional<InputEvent> pending_;
578 bool ending_{};
579 bool finished_{};
580};
581
582} // namespace portals
InputDecoder & operator=(InputDecoder &&other) noexcept=default
Reset moved-from object before reuse.
void reset() noexcept
Drop pending input/window/time/offset and recover at an explicit new session boundary....
InputDecoder(const InputDecoder &)=delete
Stateful streams cannot be copied.
static std::expected< InputDecoder, InputError > create(InputOptions options={})
Validate options and create an empty decoder. No allocations or I/O.
InputDecoder(InputDecoder &&other) noexcept=default
Moved-from object must be reset before use.
void setPointerContext(InputPointerContext context) noexcept
Set the owning context for subsequently started CSI sequences, without resetting partial input.
std::optional< InputTime > deadline() const noexcept
Return the next decode deadline, or none in ground/closed/failed state. Pending events must be draine...
std::expected< InputStep, InputError > finish(InputTime now)
End the stream, flushing at most one pending event per call. Repeat until finished/failed....
std::expected< void, InputError > expectReplies(InputProbeWindow window) noexcept
Replace expected replies; valid only in ground with no pending event. Returns INVALID_WINDOW if deadl...
std::expected< InputStep, InputError > next(std::string_view bytes, InputTime now)
Pull at most one event or protocol report, accepting at most work_bytes from a borrowed view.
InputDecoder & operator=(const InputDecoder &)=delete
Stateful streams cannot be copied.
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
Byte offsets describe the consumed rejected prefix, without raw ANSI diagnostics. Subsequent discard ...
Definition input.hpp:365
bool operator==(const InputIssue &other) const =default
Compare the complete event value.
std::uint64_t end
Exclusive offset at issue emission.
Definition input.hpp:368
bool invalidates_pointer_metrics
Rejected opt-in CSI 48; the owner must cancel/downgrade stale pixel context.
Definition input.hpp:369
InputIssueKind kind
Rejection reason.
Definition input.hpp:366
std::uint64_t begin
Inclusive session byte offset.
Definition input.hpp:367
Owning DECRPM reply; the caller validates the expected mode and protocol phase.
Definition input.hpp:405
bool operator==(const InputModeReport &other) const =default
Compare mode and reported state.
std::uint32_t state
Reported state: 0 unknown, 1 set, 2 reset, 3 permanently set, 4 permanently reset.
Definition input.hpp:407
std::uint32_t mode
DEC private mode number, without inferred support.
Definition input.hpp:406
Observed modifiers, also usable by a native input adapter.
Definition input.hpp:34
bool operator==(const InputModifiers &other) const =default
Compare the complete event value.
bool shift
Shift modifier.
Definition input.hpp:35
bool super
Super modifier; never inferred by this VT profile.
Definition input.hpp:38
constexpr bool has(key::Modifier modifier) const noexcept
Definition input.hpp:43
bool control
Control modifier.
Definition input.hpp:37
bool alt
Alt modifier (legacy ESC prefix is ambiguous).
Definition input.hpp:36
Explicit resource and timing policy, independent of terminal capabilities.
Definition input.hpp:437
bool sgr_mouse
Decode SGR cell mouse reports.
Definition input.hpp:446
std::size_t max_sequence_bytes
CSI/SS3 cap including ESC, introducer and final; 3..64.
Definition input.hpp:438
bool terminal_reports
Decode CSI 48 and DEC private mode reports outside paste.
Definition input.hpp:448
std::size_t work_bytes
Maximum accepted bytes per pull; must be positive.
Definition input.hpp:442
InputTime sequence_timeout
Whole CSI/SS3/string/ordinary UTF-8 interval; positive.
Definition input.hpp:444
std::size_t max_parameters
Numeric fields/empty CSI 48 colon slots per sequence; 1..16.
Definition input.hpp:439
InputTime paste_timeout
Whole paste interval from begin delimiter; positive.
Definition input.hpp:445
InputTime escape_timeout
ESC/Alt scalar ambiguity interval; must be positive.
Definition input.hpp:443
std::size_t max_paste_bytes
Maximum complete payload; zero permits empty paste.
Definition input.hpp:441
bool bracketed_paste
Decode bracketed paste delimiters.
Definition input.hpp:447
std::size_t max_digits
Decimal digits per field; 1..10, with checked uint32 arithmetic.
Definition input.hpp:440
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 precise pointer sample; pixel coordinates are zero based in the text area.
Definition input.hpp:257
std::uint32_t text_width_px
Positive text-area pixel width.
Definition input.hpp:262
std::uint32_t columns
Character width used for this sample.
Definition input.hpp:260
std::uint32_t y
Vertical pixel coordinate.
Definition input.hpp:259
std::uint32_t rows
Character height used for this sample.
Definition input.hpp:261
bool operator==(const InputPointerPrecision &other) const =default
Compare the complete sample and its coordinate context.
std::uint32_t text_height_px
Positive text-area pixel height.
Definition input.hpp:263
std::uint64_t generation
Owning coordinate-context generation.
Definition input.hpp:264
std::uint32_t x
Horizontal pixel coordinate.
Definition input.hpp:258
Syntactically matching reply within an explicitly expected window.
Definition input.hpp:337
std::size_t count
Number of valid parameters.
Definition input.hpp:341
std::array< std::uint32_t, 16 > values
DA parameters, or one-based CPR row/column.
Definition input.hpp:340
InputProbeKind kind
Reply grammar.
Definition input.hpp:338
std::uint64_t generation
Caller-supplied generation.
Definition input.hpp:339
bool operator==(const InputProbeCandidate &other) const =default
Compare the complete event value.
A single-use expected reply window, captured at sequence start.
Definition input.hpp:328
bool device_attributes
Allow one primary DA candidate.
Definition input.hpp:329
InputTime deadline
Exclusive end.
Definition input.hpp:333
std::uint64_t generation
Caller correlation value, not authentication.
Definition input.hpp:331
InputTime opens_at
Inclusive start.
Definition input.hpp:332
bool cursor_position
Allow one CPR candidate.
Definition input.hpp:330
Owning CSI 48 text-area dimensions, in wire order; not terminal authentication.
Definition input.hpp:392
bool operator==(const InputSizeReport &other) const =default
Compare every reported dimension.
std::uint32_t text_height_px
Text-area pixel height; zero means unavailable.
Definition input.hpp:395
std::uint32_t text_width_px
Text-area pixel width; zero means unavailable.
Definition input.hpp:396
std::uint32_t columns
Positive character width.
Definition input.hpp:394
std::uint32_t rows
Positive character height.
Definition input.hpp:393
One bounded pull result; no hidden output queue.
Definition input.hpp:429
InputStatus status
Stop reason.
Definition input.hpp:432
std::optional< InputProtocolEvent > protocol
Owning report, present only for PROTOCOL; excludes event.
Definition input.hpp:433
std::size_t consumed
Prefix of this call's bytes accepted exactly once.
Definition input.hpp:430
std::optional< InputEvent > event
At most one independent owning event.
Definition input.hpp:431
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
Checked zero-based cell coordinates; no viewport clipping is performed.
Definition input.hpp:294
MouseAction action
Observed action.
Definition input.hpp:298
bool operator==(const MouseInputEvent &other) const =default
Compare the complete event value.
double wheelDelta
Positive finite magnitude in normalized wheel detents for SCROLL; unused otherwise.
Definition input.hpp:301
MouseButton button
Button or wheel direction.
Definition input.hpp:297
std::int32_t column
Zero-based column.
Definition input.hpp:295
std::int32_t row
Zero-based row.
Definition input.hpp:296
InputModifiers modifiers
Observed modifiers.
Definition input.hpp:299
std::optional< InputPointerPrecision > precision
Optional owning 1016 sample; cell fields remain available.
Definition input.hpp:300
Owning raw paste bytes, possibly invalid UTF-8 or containing controls. Never forward these bytes to a...
Definition input.hpp:312
std::string bytes
Complete bounded payload, excluding delimiters.
Definition input.hpp:313
bool operator==(const PasteInputEvent &other) const =default
Compare the complete event value.
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