fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit f420ccb3328756fc3ae919a0739f2cedc1eb88bd parent 581099bc6126c3ac14cd51435e70d1806be39d22 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Mon, 4 Aug 2014 14:08:37 -0700 action_next and action_prev Diffstat:
| M | fzy.c | | | 12 | ++++++++++-- |
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/fzy.c b/fzy.c @@ -153,6 +153,14 @@ void emit(tty_t *tty){ exit(EXIT_SUCCESS); } +void action_prev(){ + current_selection = (current_selection + NUMLINES - 1) % NUMLINES; +} + +void action_next(){ + current_selection = (current_selection + 1) % NUMLINES; +} + void run(tty_t *tty){ run_search(search); char ch; @@ -180,9 +188,9 @@ void run(tty_t *tty){ search[search_size] = '\0'; run_search(search); }else if(ch == 14){ /* C-N */ - current_selection = (current_selection + 1) % NUMLINES; + action_next(); }else if(ch == 16){ /* C-P */ - current_selection = (current_selection + NUMLINES - 1) % NUMLINES; + action_prev(); }else if(ch == 10){ /* Enter */ clear(tty); emit(tty);