fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit bb31fb4390f96c99f8ff9108efab40d53017f8d1 parent b6bfabc1d51fb95f37ed4688e8cd952dbf2fc8b7 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Sat, 12 Jul 2014 22:16:13 -0700 Fix warnings Diffstat:
| M | fzy.c | | | 8 | ++++---- |
| M | match.c | | | 2 | +- |
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fzy.c b/fzy.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -16,7 +17,7 @@ int choices_n = 0; const char **choices = NULL; double *choices_score = NULL; size_t *choices_sorted = NULL; -int current_selection = 0; +size_t current_selection = 0; void resize_choices(int new_capacity){ choices = realloc(choices, new_capacity * sizeof(const char *)); @@ -137,11 +138,10 @@ void clear(){ void draw(){ int line = 0; - int i; const char *prompt = "> "; clear(); fprintf(ttyout, "%s%s\n", prompt, search); - for(i = 0; line < 10 && i < choices_available; i++){ + for(size_t i = 0; line < 10 && i < choices_available; i++){ if(i == current_selection) fprintf(ttyout, "%c%c7m", 0x1b, '['); else @@ -150,7 +150,7 @@ void draw(){ line++; } fprintf(ttyout, "%c%c%iA", 0x1b, '[', line + 1); - fprintf(ttyout, "%c%c%iG", 0x1b, '[', strlen(prompt) + strlen(search) + 1); + fprintf(ttyout, "%c%c%ziG", 0x1b, '[', strlen(prompt) + strlen(search) + 1); fflush(ttyout); } diff --git a/match.c b/match.c @@ -18,7 +18,7 @@ void mat_print(int *mat, int n, int m){ int i, j; for(i = 0; i < n; i++){ for(j = 0; j < m; j++){ - fprintf(stderr, " %3zd", mat[i*m + j]); + fprintf(stderr, " %3i", mat[i*m + j]); } fprintf(stderr, "\n"); }