From b051983db21290871c7a33cf8189f415c07f8a24 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 26 Oct 2026 19:15:33 +0100 Subject: terminal: improve function and control key handling --- ttwhy/terminal/events.cppm | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'ttwhy/terminal/events.cppm') diff --git a/ttwhy/terminal/events.cppm b/ttwhy/terminal/events.cppm index ce4a7d5..5df397d 100644 --- a/ttwhy/terminal/events.cppm +++ b/ttwhy/terminal/events.cppm @@ -34,6 +34,31 @@ export namespace ttwhy::terminal page_down, }; + //! Represents terminal function keys (F1 through F20). + enum struct function_key : std::uint8_t + { + f1, + f2, + f3, + f4, + f5, + f6, + f7, + f8, + f9, + f10, + f11, + f12, + f13, + f14, + f15, + f16, + f17, + f18, + f19, + f20, + }; + //! Represents individual keyboard modifier keys. enum struct modifier : std::uint8_t { @@ -138,14 +163,23 @@ export namespace ttwhy::terminal char key{}; }; + //! Represents a terminal function key event. + struct function_key_event + { + function_key key{}; + modifier_set modifiers{}; + }; + //! Variant representing any input event produced by a terminal scanner. - using input_event = std::variant; + using input_event = + std::variant; //! Validates that a sink can receive all terminal input event types. //! //! @tparam Sink The sink callable type to validate. template concept event_sink = ttwhy::event_sink && ttwhy::event_sink && - ttwhy::event_sink; + ttwhy::event_sink && ttwhy::event_sink && + ttwhy::event_sink; } // namespace ttwhy::terminal -- cgit v1.2.3