From b31dedf05fcf339026b4460add8e79a3e6bd928b Mon Sep 17 00:00:00 2001 From: Tristan Cormier Date: Mon, 17 Apr 2023 23:46:26 -0400 Subject: [PATCH] feat(console): add partial implementation of handler function OnChar --- src/console/Handlers.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/console/Handlers.cpp b/src/console/Handlers.cpp index 38880bb..e4e06a1 100644 --- a/src/console/Handlers.cpp +++ b/src/console/Handlers.cpp @@ -7,8 +7,23 @@ namespace { int32_t OnChar(const EVENT_DATA_CHAR* data, void* param) { - // TODO - return 1; + char character[2]; + + if (!EventIsKeyDown(ConsoleGetHotKey()) || !ConsoleAccessGetEnabled()) { + if (!ConsoleGetActive()) { + return 1; + } + + // Set the character value and null-terminate the buffer + character[0] = data->ch; + character[1] = '\0'; + + // TODO + // PasteInInputLine(character); + // ResetHighlight(); + } + + return 0; } int32_t OnIdle(const EVENT_DATA_IDLE* data, void* param) {