(This issue admittedly is a bit tricky, but still should not need a comprehensive understanding of the entire codebase.)
I think this could actually be hooked to the "interrupted" flag subsystem:
The new syntax would be MODIFIER = oneShot. It would make the macro subsystem treat such modified key as being pressed for as long as needed - that is until the "interrupted" thing is activated, plus some safety margin.
Implementation notes:
add a new flag in the "macro action scope" memory region which would indicate that oneShot is active.
entangle the flag appropriately with the interrupted flag.
modify currentMacroKeyIsActive to return true as long as this flag is true.
add a timer so that the oneShot thing remains active for a some time after the key is "interrupted" by other key activation. (This delay should probably be of keystrokeDelay length and be implemented on macro level, or maybe by inserting a new event type into the postponer. ) Actually, waiting 2 cycles after the "interrupt" event should suffice. This means returning twice MacroResult_Blocking, then resetting the "oneShot" flag
multiple oneshot modifiers should probably compose, so it is reasonable to implement the timer using static variables. (The standard delayUntil cannot be used because it would interfere with the memory of the actual command which is being "modified")
--> https://github.com/UltimateHackingKeyboard/firmware/issues/464
(This issue admittedly is a bit tricky, but still should not need a comprehensive understanding of the entire codebase.)
I think this could actually be hooked to the "interrupted" flag subsystem:
The new syntax would be
MODIFIER = oneShot
. It would make the macro subsystem treat such modified key as being pressed for as long as needed - that is until the "interrupted" thing is activated, plus some safety margin.Implementation notes:
(This delay should probably be ofActually, waiting 2 cycles after the "interrupt" event should suffice. This means returning twicekeystrokeDelay
length and be implemented on macro level, or maybe by inserting a new event type into the postponer. )MacroResult_Blocking
, then resetting the "oneShot" flag