Created
August 1, 2022 03:17
-
-
Save petejohanson/b28ab5e47cfe473d756fcfd82900820f to your computer and use it in GitHub Desktop.
Combo bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int filter_timed_out_candidates(int64_t timestamp) { | |
int num_candidates = 0; | |
for (int i = 0; i < CONFIG_ZMK_COMBO_MAX_COMBOS_PER_KEY; i++) { | |
struct combo_candidate *candidate = &candidates[i]; | |
if (candidate->combo == NULL) { | |
break; | |
} | |
if (candidate->timeout_at > timestamp) { | |
// reorder candidates so they're contiguous | |
candidates[num_candidates].combo = candidate->combo; | |
candidates[num_candidates].timeout_at = candidates->timeout_at; | |
num_candidates++; | |
} else { | |
candidate->combo = NULL; | |
} | |
} | |
return num_candidates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment