dynamic_macro.h: Do not save the keys being held when stopping the recording
More specifically, we save them and then place the `macro_end` pointer before them so they are essentially ignored and the other macro may freely overwrite them.
This commit is contained in:
parent
436d661775
commit
4b50ea15a9
1 changed files with 15 additions and 3 deletions
|
@ -127,10 +127,22 @@ void dynamic_macro_record_key(
|
||||||
* End recording of the dynamic macro. Essentially just update the
|
* End recording of the dynamic macro. Essentially just update the
|
||||||
* pointer to the end of the macro.
|
* pointer to the end of the macro.
|
||||||
*/
|
*/
|
||||||
void dynamic_macro_record_end(keyrecord_t *macro_pointer, keyrecord_t **macro_end)
|
void dynamic_macro_record_end(
|
||||||
|
keyrecord_t *macro_buffer,
|
||||||
|
keyrecord_t *macro_pointer,
|
||||||
|
int8_t direction,
|
||||||
|
keyrecord_t **macro_end)
|
||||||
{
|
{
|
||||||
dynamic_macro_led_blink();
|
dynamic_macro_led_blink();
|
||||||
|
|
||||||
|
/* Do not save the keys being held when stopping the recording,
|
||||||
|
* i.e. the keys used to access the layer DYN_REC_STOP is on.
|
||||||
|
*/
|
||||||
|
while (macro_pointer != macro_buffer &&
|
||||||
|
(macro_pointer - direction)->event.pressed) {
|
||||||
|
macro_pointer -= direction;
|
||||||
|
}
|
||||||
|
|
||||||
*macro_end = macro_pointer;
|
*macro_end = macro_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,10 +234,10 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record)
|
||||||
* starts. */
|
* starts. */
|
||||||
switch (macro_id) {
|
switch (macro_id) {
|
||||||
case 1:
|
case 1:
|
||||||
dynamic_macro_record_end(macro_pointer, ¯o_end);
|
dynamic_macro_record_end(macro_buffer, macro_pointer, +1, ¯o_end);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
dynamic_macro_record_end(macro_pointer, &r_macro_end);
|
dynamic_macro_record_end(r_macro_buffer, macro_pointer, -1, &r_macro_end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
macro_id = 0;
|
macro_id = 0;
|
||||||
|
|
Loading…
Reference in a new issue