# Leader unable to distuinguish A from AA sequences

**URL:** <https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853>\
**Category:** Programming\
**Created:** [October 26, 2022, 11:54am UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853 "2022-10-26T11:54:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![klackityklak](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@klackityklak](https://community.keyboard.io/u/klackityklak)\
**Post date:** [October 26, 2022, 11:54am UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853/1 "2022-10-26T11:54:18Z")

</div>

I am unable to get one of the code examples given for Leader to work correctly. The code example from: [Keystrokes/Leader/Leader.ino — Kaleidoscope documentation](https://kaleidoscope.readthedocs.io/en/latest/examples/Keystrokes/Leader/Leader.ino.html) leads me to think that Leader emulation of Tap Dance is possible, along with Leader sequences such as C, CA, CC, CCX all possible. According to the code example:

static void leaderTestA(uint8\_t seq\_index) {  
serial\_port.println(F(“leaderTestA”));  
}

static void leaderTestAA(uint8\_t seq\_index) {  
serial\_port.println(F(“leaderTestAA”));  
}

static const kaleidoscope::plugin::Leader::dictionary\_t leader\_dictionary PROGMEM =  
LEADER\_DICT({LEADER\_SEQ(LEAD(0), Key\_A), leaderTestA},  
{LEADER\_SEQ(LEAD(0), Key\_A, Key\_A), leaderTestAA});

both A and AA should be recognized but when I try this example only the A sequence works since there does not seem to be a timer telling the program to wait to see if there is another matching sequence in the dictionary.

I am trying to port my Key Maps over from QMK and this is one of the most used features for me. How do I make this function work correctly?

---

<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:** [October 26, 2022, 6:57pm UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853/2 "2022-10-26T18:57:42Z")

</div>

I don’t have the resources to look into this right now, but if you could file an issue against Kaleidoscope, then it won’t fall of my radar, and I’ll take a look as soon as I can. This definitely sounds like a bug, Leader should support A and AA sequences.

Mind you, the intended effect is that if there are both an `A` and an `AA` sequence, then tapping `LEAD A A` would perform _both_, not just `AA`, unless the `A` action calls `Leader.reset()`.

---

<div class="post-metadata">

**Author:** ![klackityklak](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@klackityklak](https://community.keyboard.io/u/klackityklak)\
**Post date:** [October 27, 2022, 2:28am UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853/3 "2022-10-27T02:28:22Z")

</div>

The results that I am getting seem to be the same results as if I had called Leader.reset() with action A.  
If I understand your last sentence, I can have action A, or action A _and_ action AA, but never just action AA. I am at a loss as to how that would be useful.

---

<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:** [October 27, 2022, 5:00am UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853/4 "2022-10-27T05:00:43Z")

</div>

> [@klackityklak](#):
>
> If I understand your last sentence, I can have action A, or action A _and_ action AA, but never just action AA.

Correct.

> [@klackityklak](#):
>
> I am at a loss as to how that would be useful.

It’s not that it would be useful. It’s about being easier to implement, and so far, not needing to do better. I’m certainly open to improving Leader, and making it possible to have an A and AA sequence, and have the latter not trigger the first. Can you file an issue against Kaleidoscope on GitHub? That’d help me not loose track of it.

---

<div class="post-metadata">

**Author:** ![Moilleadoir](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/moilleadoir/32/4122_2.png) [@Moilleadoir](https://community.keyboard.io/u/Moilleadoir)\
**Post date:** [May 14, 2023, 4:48am UTC](https://community.keyboard.io/t/leader-unable-to-distuinguish-a-from-aa-sequences/5853/5 "2023-05-14T04:48:27Z")

</div>

The real issue is that this is the **example** of how to use Leader, but it can’t work.
