diff --git a/tests/issues/1061/1061.ino b/tests/issues/1061/1061.ino index f9d8b275..df2c20cd 100644 --- a/tests/issues/1061/1061.ino +++ b/tests/issues/1061/1061.ino @@ -21,7 +21,7 @@ KEYMAPS( [0] = KEYMAP_STACKED ( - Key_Insert, ___, ___, ___, ___, ___, ___, + Key_Insert, OSM(LeftAlt), OSM(RightAlt), ___, ___, ___, ___, Key_A, Key_B, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, @@ -51,6 +51,12 @@ class OneShotInsert : public Plugin { } }; +bool OneShot::isStickable(Key key) { + if (key == Key_LeftAlt) + return false; + return OneShot::isStickableDefault(key); +} + } // namespace plugin } // namespace kaleidoscope diff --git a/tests/issues/1061/test.ktest b/tests/issues/1061/test.ktest index 1d72c372..ee4aecd9 100644 --- a/tests/issues/1061/test.ktest +++ b/tests/issues/1061/test.ktest @@ -1,6 +1,8 @@ VERSION 1 KEYSWITCH INSERT 0 0 +KEYSWITCH LALT 0 1 +KEYSWITCH RALT 0 2 KEYSWITCH A 1 0 KEYSWITCH B 1 1 @@ -98,3 +100,69 @@ RUN 1 cycle EXPECT keyboard-report empty RUN 5 ms + +# ============================================================================== +NAME OneShot left alt not sticky + +RUN 4 ms +PRESS LALT +RUN 1 cycle +EXPECT keyboard-report Key_LeftAlt + +RUN 4 ms +RELEASE LALT +RUN 1 cycle + +RUN 4 ms +PRESS LALT +RUN 1 cycle + +RUN 4 ms +RELEASE LALT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms + +# ============================================================================== +NAME OneShot right alt sticky + +RUN 4 ms +PRESS RALT +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt + +RUN 4 ms +RELEASE RALT +RUN 1 cycle + +RUN 4 ms +PRESS RALT +RUN 1 cycle + +RUN 4 ms +RELEASE RALT +RUN 1 cycle + +RUN 4 ms +PRESS A +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt Key_A + +RUN 4 ms +RELEASE A +RUN 1 cycle +EXPECT keyboard-report Key_RightAlt + +RUN 100 ms + +RUN 4 ms +PRESS RALT +RUN 1 cycle + +RUN 4 ms +RELEASE RALT +RUN 1 cycle +EXPECT keyboard-report empty + +RUN 5 ms