How does OneShot work with arrows?

How does OneShot work with arrow keys? For instance to select the previous two words I usually type ctrl-shift-left arrow-left arrow. Would OneShot release the modifiers after the first arrow? What if I hold the left arrow down - would it keep moving the selection to the left?

As far as I remember, holding the arrow key would still cancel the modifiers, but I need to check to be sure.

You can, however, hold the one-shot modifiers, and they will remain active as long as they are held, even if you press left arrow twice during this time. Or you can double-tap a one-shot modifier to make them sticky (and toggle them off with a third tap later).

Is there a way to modify OneShot so that arrows don’t cancel the modifiers?

That’s not something I’d put into OneShot itself, but you can change the plugin locally. This is the code that would need a bit of changing, in particular, line 156. Extend that check with one that checks if the key is not an arrow, and you should be good to go.

At one point I did consider adding a way to customize which keys OneShot should treat special, keys that do not result in cancelling one-shot state. I might revisit that idea in the not too distant future, but will need to find a way that makes doing that convenient, and has little overhead.

1 Like

So would it work to change line 156 as follows:

if (!isModifier(mapped_key) 
  && (mapped_key.flags != (KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP)) 
  && (mapped_key != Key_UpArrow) && (mapped_key != Key_DownArrow) 
  && (mapped_key != Key_LeftArrow) && (mapped_key != Key_RightArrow) ) {

Yeah, that should do the trick. (At a first read, anyway)

1 Like

Thanks! I’ll try it.

By the way, I just installed Arduino and K-scope today, but the version of OneShot.cpp that it installed was from 11/14/17, although it looks like you’ve made several changes since then. Is there a way I can make sure to get the newest versions of the plugins?

Yep. Instead of installing via the Arduino IDE, clone the Arduino-Boards with git, and use that. The Kaleidoscope repo on GitHub has a short description on how to do this.

1 Like