summaryrefslogtreecommitdiff
path: root/nncmpp.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-06-05 01:24:10 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-06-05 01:24:10 +0200
commit99f2117d4c663855fa933308388446671b1fa734 (patch)
tree01822a1badf4c22fa3f4da620475bbeb69c1d108 /nncmpp.c
parent8c260c3fc3fbb58cc1bd0e30ef85de3d926236ab (diff)
downloadnncmpp-99f2117d4c663855fa933308388446671b1fa734.tar.gz
nncmpp-99f2117d4c663855fa933308388446671b1fa734.tar.xz
nncmpp-99f2117d4c663855fa933308388446671b1fa734.zip
Implement L/M/H bindings
Diffstat (limited to 'nncmpp.c')
-rw-r--r--nncmpp.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/nncmpp.c b/nncmpp.c
index 1ef8343..14059c3 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -1489,7 +1489,11 @@ app_goto_tab (int tab_index)
XX( GOTO_ITEM_PREVIOUS, "Go to the previous item" ) \
XX( GOTO_ITEM_NEXT, "Go to the next item" ) \
XX( GOTO_PAGE_PREVIOUS, "Go to the previous page" ) \
- XX( GOTO_PAGE_NEXT, "Go to the next page" )
+ XX( GOTO_PAGE_NEXT, "Go to the next page" ) \
+ \
+ XX( GOTO_VIEW_TOP, "Select the top item" ) \
+ XX( GOTO_VIEW_CENTER, "Select the center item" ) \
+ XX( GOTO_VIEW_BOTTOM, "Select the bottom item" )
enum action
{
@@ -1675,6 +1679,19 @@ app_process_action (enum action action)
app_move_selection (app_visible_items ());
break;
+ case ACTION_GOTO_VIEW_TOP:
+ g.active_tab->item_selected = g.active_tab->item_top;
+ app_move_selection (0);
+ break;
+ case ACTION_GOTO_VIEW_CENTER:
+ g.active_tab->item_selected = g.active_tab->item_top;
+ app_move_selection (MAX (0, app_visible_items () / 2 - 1));
+ break;
+ case ACTION_GOTO_VIEW_BOTTOM:
+ g.active_tab->item_selected = g.active_tab->item_top;
+ app_move_selection (MAX (0, app_visible_items () - 1));
+ break;
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
case ACTION_NONE:
@@ -1808,6 +1825,10 @@ g_default_bindings[] =
{ "C-b", ACTION_GOTO_PAGE_PREVIOUS, {}},
{ "C-f", ACTION_GOTO_PAGE_NEXT, {}},
+ { "H", ACTION_GOTO_VIEW_TOP, {}},
+ { "M", ACTION_GOTO_VIEW_CENTER, {}},
+ { "L", ACTION_GOTO_VIEW_BOTTOM, {}},
+
// Not sure how to set these up, they're pretty arbitrary so far
{ "Enter", ACTION_CHOOSE, {}},
{ "Delete", ACTION_DELETE, {}},