diff options
author | Anna Arad <4895022+annagrram@users.noreply.github.com> | 2019-10-11 17:11:56 +0300 |
---|---|---|
committer | Mischievous Meerkat <engineerarun@gmail.com> | 2019-10-11 19:41:56 +0530 |
commit | ab8e3e445e054a0e28aca52e0eb5a5469650a1bc (patch) | |
tree | 21e04a20c3edb9ccaf37654276515da4df3fda54 /src | |
parent | a7d224f1e5a063d15f8ef546aa54609344246750 (diff) | |
download | nnn-ab8e3e445e054a0e28aca52e0eb5a5469650a1bc.tar.gz |
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -4671,6 +4671,22 @@ nochange: } } +static void check_keybinding_collision(void) +{ + unsigned long i; + bool bitmap[KEY_MAX] = {FALSE}; + + for (i = 0; i < sizeof(bindings) / sizeof(struct key); ++i) { + int curr_sym = bindings[i].sym; + + if (bitmap[curr_sym]) + fprintf(stdout, + "Collision of key %s detected\n", keyname(curr_sym)); + else + bitmap[curr_sym] = TRUE; + } +} + static void usage(void) { fprintf(stdout, @@ -4685,6 +4701,7 @@ static void usage(void) " -d detail mode\n" " -f run filter as cmd on prompt key\n" " -H show hidden files\n" + " -K test for keybinding collision\n" " -i nav-as-you-type mode\n" " -n version sort\n" " -o open files on Enter\n" @@ -4828,7 +4845,7 @@ int main(int argc, char *argv[]) bool progress = FALSE; #endif - while ((opt = getopt(argc, argv, "HSiab:cdfnop:rstvh")) != -1) { + while ((opt = getopt(argc, argv, "HSKiab:cdfnop:rstvh")) != -1) { switch (opt) { case 'S': cfg.blkorder = 1; @@ -4891,6 +4908,9 @@ int main(int argc, char *argv[]) case 't': cfg.autoselect = 0; break; + case 'K': + check_keybinding_collision(); + return _SUCCESS; case 'v': fprintf(stdout, "%s\n", VERSION); return _SUCCESS; |