From 6d627bac82f84e39beda51981ddf3a6ddabbbe78 Mon Sep 17 00:00:00 2001 From: Anders Damsgaard Date: Tue, 3 Feb 2015 10:27:51 +0100 Subject: [PATCH] Add vi-ish navigation to first and last slide Navigate to first and last slide with 'g' and 'G', respectively. This resembles the behavior of vi, that uses 'gg' and 'G' for the first and last lines in a file. These keybinds are useful for keyboards without dedicated home/end keys. --- sample.md | 4 ++-- src/viewer.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sample.md b/sample.md index b717393..95d767e 100644 --- a/sample.md +++ b/sample.md @@ -18,8 +18,8 @@ previous slide *Backspace*, *Page Up*, *h*, *k*, quit *q* reload *r* slide N *1..9* -first slide *Home* -last slide *End* +first slide *Home*, *g* +last slide *End*, *G* ------------------------------------------------- diff --git a/src/viewer.c b/src/viewer.c index b540b1a..3e391b1 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -394,12 +394,14 @@ int ncurses_display(deck_t *deck, int notrans, int nofade, int invert, int reloa break; // show first slide + case 'g': case KEY_HOME: slide = deck->slide; sc = 1; break; // show last slide + case 'G': case KEY_END: for(i = sc; i <= deck->slides; i++) { if(slide->next) { -- 2.20.1