# How does OneShot work with arrows?

**URL:** <https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881>\
**Category:** Help and Getting Started\
**Created:** [December 19, 2017, 1:32pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881 "2017-12-19T13:32:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [December 19, 2017, 1:32pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/1 "2017-12-19T13:32:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [December 19, 2017, 1:36pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/2 "2017-12-19T13:36:59Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [December 19, 2017, 2:18pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/3 "2017-12-19T14:18:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [December 19, 2017, 2:24pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/4 "2017-12-19T14:24:16Z")

</div>

> [@fire](#):
>
> 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](https://github.com/keyboardio/Kaleidoscope-OneShot/blob/4b6ca2fab3394693e299e5d23e8e03683f3b03e1/src/Kaleidoscope/OneShot.cpp#L152-L161) is the code that would need a bit of changing, in particular, [line 156](https://github.com/keyboardio/Kaleidoscope-OneShot/blob/4b6ca2fab3394693e299e5d23e8e03683f3b03e1/src/Kaleidoscope/OneShot.cpp#L156). 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.

---

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [December 19, 2017, 2:29pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/5 "2017-12-19T14:29:55Z")

</div>

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) ) {
```

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [December 19, 2017, 2:33pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/6 "2017-12-19T14:33:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [December 19, 2017, 2:38pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/7 "2017-12-19T14:38:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [December 19, 2017, 2:42pm UTC](https://community.keyboard.io/t/how-does-oneshot-work-with-arrows/881/8 "2017-12-19T14:42:12Z")

</div>

> [@fire](#):
>
> 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](https://github.com/keyboardio/Arduino-Boards) with git, and use that. The `Kaleidoscope` repo on GitHub has a [short description](https://github.com/keyboardio/Kaleidoscope#install-the-kaleidoscope-hardware-definitions) on how to do this.
