Skip to content

Commit

Permalink
Implement a basic keybinding collision checker. (ToDo list #337)
Browse files Browse the repository at this point in the history
  • Loading branch information
annagrram committed Oct 10, 2019
1 parent f72cf4c commit 9b32da1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions misc/keybind-collision-checker/collision.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>

#include "../../src/nnn.h"

int main() {
int i;

// CONTROL(KEY_MAX) == 447
bool bitmap[CONTROL(KEY_MAX)] = {FALSE};

for (i = 0; i < sizeof(bindings) / sizeof(struct key); ++i) {
int curr_sym = bindings[i].sym;

if (bitmap[curr_sym])
printf("Collision of key %s detected\n", keyname(curr_sym));
else
bitmap[curr_sym] = TRUE;
}
}

0 comments on commit 9b32da1

Please sign in to comment.