Add `afterReportingState()` handler to OneShot

If multiple events are processed in a single cycle, we want a OneShot key whose
release is triggered by the first one to only affect that key, and not
subsequent ones.  For example, if we tap `OSM(LeftShift)`, then `TD(0)`, then
`Key_X`, the OneShot shift should only apply to the output of the TapDance key,
not the `x`.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1035/head
Michael Richters 4 years ago
parent 92f2f582f1
commit 1ff881a86b
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -321,6 +321,11 @@ EventHandlerResult OneShot::onKeyEvent(KeyEvent& event) {
return EventHandlerResult::OK; return EventHandlerResult::OK;
} }
// ----------------------------------------------------------------------------
EventHandlerResult OneShot::afterReportingState(const KeyEvent& event) {
return afterEachCycle();
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
EventHandlerResult OneShot::afterEachCycle() { EventHandlerResult OneShot::afterEachCycle() {

@ -222,6 +222,7 @@ class OneShot : public kaleidoscope::Plugin {
EventHandlerResult onNameQuery(); EventHandlerResult onNameQuery();
EventHandlerResult onKeyEvent(KeyEvent &event); EventHandlerResult onKeyEvent(KeyEvent &event);
EventHandlerResult afterReportingState(const KeyEvent &event);
EventHandlerResult afterEachCycle(); EventHandlerResult afterEachCycle();
private: private:

Loading…
Cancel
Save