diff options
author | sin <sin@2f30.org> | 2018-04-09 13:32:25 +0100 |
---|---|---|
committer | sin <sin@2f30.org> | 2018-04-09 13:42:51 +0100 |
commit | 2a97bab5af5aba7ba6889e14c0fd47fe8110d85a (patch) | |
tree | 6ac09a818821486a02f6a741383e902b918781fe /noice.c | |
parent | 155496adf93b918311950e3c70aa1d5d54565f5e (diff) | |
download | noice-2a97bab5af5aba7ba6889e14c0fd47fe8110d85a.tar.gz |
Change emacs keybinds for jumping to first/last entry
Signed-off-by: sin <sin@2f30.org>
Diffstat (limited to 'noice.c')
-rw-r--r-- | noice.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -38,6 +38,7 @@ #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define ISODD(x) ((x) & 1) #define CONTROL(c) ((c) ^ 0x40) +#define META(c) ((c) ^ 0x80) struct assoc { char *regex; /* Regex to match on filename */ @@ -335,18 +336,28 @@ printprompt(char *str) printw(str); } -/* Returns SEL_* if key is bound and 0 otherwise. - * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */ -int -nextsel(char **run, char **env) +int xgetch(void) { - int c, i; + int c; c = getch(); if (c == -1) idle++; else idle = 0; + return c; +} + +/* Returns SEL_* if key is bound and 0 otherwise. + * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */ +int +nextsel(char **run, char **env) +{ + int c, i; + + c = xgetch(); + if (c == 033) + c = META(xgetch()); for (i = 0; i < LEN(bindings); i++) if (c == bindings[i].sym) { |