diff --git a/plugins/Kaleidoscope-Escape-OneShot/README.md b/plugins/Kaleidoscope-Escape-OneShot/README.md index 8debee44..ce223255 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/README.md +++ b/plugins/Kaleidoscope-Escape-OneShot/README.md @@ -5,6 +5,9 @@ effect - or act as the normal `Esc` key if none are active, or if any of them are still held. For those times when one accidentally presses a one-shot key, or change their minds. +Additionally, the special `Key_OneShotCancel` key will also count as a oneshot +cancel key, would one want a dedicated key for the purpose. + ## Using the plugin To use the plugin, one needs to include the header, and activate it. No further @@ -59,7 +62,7 @@ configuration methods: > (including sticky) keys. The default is to use `Key_Escape` (the > normal `Esc` key), but if you would rather have a dedicated key (so > that you can use `Key_Escape` in combination with one-shot -> modifiers), there is the special `OneShotCancelKey`, which will not +> modifiers), there is the special `Key_OneShotCancel`, which will not > have any side effects. ### `.getCancelKey(key)` diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp index b1a53fb6..832664d3 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.cpp @@ -38,7 +38,11 @@ EventHandlerResult EscapeOneShot::onKeyEvent(KeyEvent &event) { // set) that has just been pressed, and not generated by some other // plugin. Also, only if at least one OneShot key is active and/or // sticky. Last, only if there are no OneShot keys currently being held. - if (event.key == settings_.cancel_oneshot_key && + // + // `Key_OneShotCancel` will always count as an escape key, even if not + // explicitly set so. + if ((event.key == settings_.cancel_oneshot_key || + event.key == Key_OneShotCancel) && keyToggledOn(event.state) && !keyIsInjected(event.state) && ::OneShot.isActive()) { diff --git a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h index bd14ff21..b39c436c 100644 --- a/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h +++ b/plugins/Kaleidoscope-Escape-OneShot/src/kaleidoscope/plugin/Escape-OneShot.h @@ -20,7 +20,10 @@ #include "kaleidoscope/Runtime.h" #include +// DEPRECATED: `OneShotCancelKey` doesn't match our normal naming, and should +// eventually be removed. constexpr Key OneShotCancelKey {kaleidoscope::ranges::OS_CANCEL}; +constexpr Key Key_OneShotCancel {kaleidoscope::ranges::OS_CANCEL}; namespace kaleidoscope { namespace plugin {