From 2d906ffe8766aa310a129593baa941d8db49dfb8 Mon Sep 17 00:00:00 2001 From: magiblot Date: Thu, 24 Oct 2024 01:18:09 +0200 Subject: [PATCH] platform: update key normalization tests --- source/platform/termio.cpp | 2 +- source/tvision/tvtext2.cpp | 1 + test/platform/termio.test.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/platform/termio.cpp b/source/platform/termio.cpp index 8eec86ab..df6ec790 100644 --- a/source/platform/termio.cpp +++ b/source/platform/termio.cpp @@ -338,7 +338,7 @@ void TermIO::normalizeKey(KeyDownEvent &keyDown) noexcept { // Modifier precedece: Shift < Ctrl < Alt. int largestMod = (newMods & kbLeftAlt) ? 2 - : (newMods & kbLeftShift) ? 1 + : (newMods & kbLeftCtrl) ? 1 : 0; if (ushort keyCode = moddedKeyCodes[tKey.code][largestMod]) { diff --git a/source/tvision/tvtext2.cpp b/source/tvision/tvtext2.cpp index a4713328..39424408 100644 --- a/source/tvision/tvtext2.cpp +++ b/source/tvision/tvtext2.cpp @@ -10,6 +10,7 @@ * */ +#define Uses_TKeys #define Uses_TEditWindow #define Uses_TFileList #define Uses_TProgram diff --git a/test/platform/termio.test.cpp b/test/platform/termio.test.cpp index f8eb1dc0..7156ced5 100644 --- a/test/platform/termio.test.cpp +++ b/test/platform/termio.test.cpp @@ -20,10 +20,10 @@ TEST(TermIO, ShouldNormalizeKeys) {keyDownEv('a', kbLeftAlt, "a"), keyDownEv(kbAltA, kbLeftAlt, "")}, {keyDownEv(kbIns, kbShift, ""), keyDownEv(kbShiftIns, kbShift, "")}, {keyDownEv(kbBack, kbLeftCtrl | kbLeftAlt, ""), keyDownEv(kbAltBack, kbLeftCtrl | kbLeftAlt, "")}, - {keyDownEv(kbCtrlBack, kbLeftCtrl, ""), keyDownEv(kbCtrlBack, kbLeftCtrl, "")}, - {keyDownEv(kbCtrlBack, 0x0000, ""), keyDownEv(kbCtrlBack, kbCtrlShift, "")}, + {keyDownEv(kbCtrlBack, kbRightCtrl, ""), keyDownEv(kbCtrlBack, kbRightCtrl, "")}, + {keyDownEv(kbCtrlBack, 0x0000, ""), keyDownEv(kbCtrlBack, kbLeftCtrl, "")}, {keyDownEv(kbIns, kbLeftCtrl | kbEnhanced, ""), keyDownEv(kbCtrlIns, kbLeftCtrl | kbEnhanced, "")}, - {keyDownEv(kbCtrlDel, kbLeftAlt, ""), keyDownEv(kbAltDel, kbCtrlShift | kbLeftAlt, "")}, + {keyDownEv(kbCtrlDel, kbLeftAlt, ""), keyDownEv(kbAltDel, kbLeftCtrl | kbLeftAlt, "")}, }; for (auto &testCase : testCases)