commit b90df0a42da7aecd8001bcdfc969cf4502ed29bc from: Marcel Rodrigues date: Fri Jun 05 16:14:28 2015 UTC Merge pull request #8 from joshaw/add-jmp-top-bot Add keybinding to jump to top/bottom of listing. commit - cb23b74df4e63581a7c53bf2bfb6d90dcf85bc5c commit + b90df0a42da7aecd8001bcdfc969cf4502ed29bc blob - b421f9a77e7441295fbf3d771ce85614a0eb8837 blob + 2692cf950b816a7dba4a9e12347e9c4cf981c2f0 --- README.md +++ README.md @@ -32,6 +32,7 @@ Quick Start ? - show Rover manual j/k - move cursor down/up J/K - move cursor down/up 10 lines + g/G - move cursor to top/bottom of listing l - enter selected directory h - go to parent directory H - go to $HOME directory blob - 1d10ed0ab2ca65a7d97615dc95f5302f2a4aacd7 blob + 8e3e9294c9f8de42afed3e7b7eab451174e5716b --- config.h +++ config.h @@ -8,6 +8,8 @@ #define RVK_UP "k" #define RVK_JUMP_DOWN "J" #define RVK_JUMP_UP "K" +#define RVK_JUMP_TOP "g" +#define RVK_JUMP_BOTTOM "G" #define RVK_CD_DOWN "l" #define RVK_CD_UP "h" #define RVK_HOME "H" blob - e72d3dabf7f083a54ec772ea1624c44da8c92e5c blob + 4a575ae9b193f6eb8d179a83fd471ba1a4f37405 --- rover.1 +++ rover.1 @@ -72,6 +72,9 @@ Move cursor down/up. .B J/K Move cursor down/up 10 lines. .TP +.B g/G +Move cursor to top/bottom of listing. +.TP .B l Enter selected directory. .TP blob - 4e79093b48d7a04da1ae16a64f6c06d702ea4601 blob + 57e301f8474690a9a283ce3b12f36a45c2b00bf2 --- rover.c +++ rover.c @@ -847,6 +847,16 @@ main(int argc, char *argv[]) if (!rover.nfiles) continue; ESEL = MAX(ESEL - RV_JUMP, 0); SCROLL = MAX(SCROLL - RV_JUMP, 0); + update_view(); + } else if (!strcmp(key, RVK_JUMP_TOP)) { + if (!rover.nfiles) continue; + ESEL = 0; + SCROLL = 0; + update_view(); + } else if (!strcmp(key, RVK_JUMP_BOTTOM)) { + if (!rover.nfiles) continue; + ESEL = rover.nfiles - 1; + SCROLL = HEIGHT - rover.nfiles - 1; update_view(); } else if (!strcmp(key, RVK_CD_DOWN)) { if (!rover.nfiles || !S_ISDIR(EMODE(ESEL))) continue;