From 386774296555d3eba5b45da8d1f1208f68403e97 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Fri, 26 Sep 2014 08:19:53 +0330 Subject: [PATCH] fbvis: more keys for moving to the next/previous file --- README | 10 +++++----- fbvis.c | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README b/README index 4e2cb48..78485ff 100644 --- a/README +++ b/README @@ -8,9 +8,9 @@ visualize on the framebuffer. KEYBINDING ========== -The following table describes fbvis keybinding. Most of these -commands accept a numerical prefix that specifies the number of times -the command should be repeated. +The following table describes fbvis' keybinding. Most of these +commands accept a numerical prefix that specifies the number of +times the command should be repeated. ============== ================================================ KEY COMMAND @@ -22,8 +22,8 @@ h scroll left H show image top M show image centre L show image bottom -^F next file -^B previous file +^F, J, n next file +^B, K, p previous file backspace, ^U page up space, ^D page down f zoom to fit image height diff --git a/fbvis.c b/fbvis.c index 52d0ee2..d683828 100644 --- a/fbvis.c +++ b/fbvis.c @@ -165,7 +165,6 @@ static void mainloop(void) int step = fb_rows() / PAGESTEPS; int hstep = fb_cols() / PAGESTEPS; int c; - term_setup(); draw(); while ((c = readkey()) != -1) { switch (c) { @@ -211,11 +210,18 @@ static void mainloop(void) case CTRLKEY('l'): break; case CTRLKEY('f'): + case 'J': + case 'n': + if (nextfile(getcount(1))) + return; + break; case CTRLKEY('b'): - if (!nextfile(c == CTRLKEY('f') ? getcount(1) : -getcount(1))) - break; + case 'K': + case 'p': + if (nextfile(-getcount(1))) + return; + break; case 'q': - term_cleanup(); return; case 'i': printinfo(); @@ -248,7 +254,9 @@ int main(int argc, char *argv[]) fb_free(); return 1; } + term_setup(); mainloop(); + term_cleanup(); fb_free(); freebufs(); printf("\n"); -- 2.11.4.GIT