Making continue-list check if currently pressed modifiers exactly mach listed key modifiers
We want to check that only the modifiers applied to the key in the continue-list match the currently pressed modifiers, otherwise the auto-layer is released.
Given, for example:
continue-list = <BACKSPACE UNDERSCORE N0 N1 N2 N3 N4 N5 N6 N7 N8 N9>;
Currently EXCLAMATION, AT etc... it going to be evaluated as a continue, I don't know if it is intended but it felt a bit confusing to me thus the PR.
Note that I thought also about evaluating the shifting in the auto_layer_is_numeric function but if felt like it's gonna be a more breaking change, and in any case, I think if the logic in key_list_contains was not intended, this fix is still valid.
This is by design so that one doesn't have to specify
continue-list = <A LS(A) RS(A) LC(A) RC(A) LC(LS(A)) RC(LS(A)) ...>`
to whitelist A with all its modifier combinations (that's 2 ** 8 = 256 combinations in total).
The current implementation continues whenever the modifiers specified in continue-list are weakly contained in the union of explicit and implicit modifiers. So continue-list = <LS(A)> would terminate on A while continue-list = <A> wouldn't terminate on LS(A). To me that seems the most reasonable default behavior.
I could be convinced to add a configurable property to enforce a strict modifier check as I have done here: https://github.com/urob/zmk-adaptive-key/blob/ceaf0c7b29794b6d61c710886d27c47f49dfc9a1/src/behaviors/behavior_adaptive_key.c#L101-L114
Btw, I don't think the PR does what you want. As it is, you just reversed the logic so that adding continue-list = <EXCLAMATION> would continue on N1.
Thanks for the response, maybe I am going about this all wrong, my use case is that I want to implement my own caps word, that supports alphas, underscore, numbers but break on anything else. I have a layer with all shifted alpha (and underscore instead of minus), that I switch to with auto-layer. My problem with the default zmk implementation is that I want it to break on modifiers (ctrl + y for accepting completion), and also want to have minus default to underscore, a custom layer gives me this flexibility.
Combined with this:
my_caps_word: my_caps_word {
compatible = "zmk,behavior-auto-layer";
#binding-cells = <1>;
continue-list = <BACKSPACE UNDERSCORE N0 N1 N2 N3 N4 N5 N6 N7 N8 N9>;
ignore-alphas;
};
With the change I made I’m able to achieve that with the definition above.
my_caps_word: my_caps_word {
compatible = "zmk,behavior-auto-layer";
#binding-cells = <1>;
continue-list = <BACKSPACE UNDERSCORE>;
ignore-alphas;
ignore-numbers;
};
but to my surprise, my symbols layer didn’t stop the auto-layer, after investigating the code a bit i noticed that modifiers are not checked if key codes match a number or alpha if they are ignored. Which is ok for alphas since a shifted alpha is still an alpha but seemed counter intuitive for numbers, but I have narrow visibility how this module is used.
And you are right, thinking about it more the change I did is counterintuitive, as id doesn’t involve strictness. And hitting minus in my example would not break the sequence. So in any case it’s not good, sorry for the haste.
So maybe I’m going beyond the intended use case of this module, but it seemed close enough to have my perfect caps word :)
“I could be convinced to add a configurable property to enforce a strict modifier check” This would work for my use case as well, if you are convinced it is a valid use for this module !
If I understand correctly, you want a caps-word that doesn't terminate on numbers and underscore? In that case, this module might indeed be overkill as a capsword-based approach wouldn't require creating an extra layer with capitalized alphas.
Did you already try the new capsword? IIRC it has more customization options that should allow setting it up so it continues on numbers and underscore.