Commit bacdc19d authored by Sebastian Ramacher's avatar Sebastian Ramacher

Implement G and gg for index mode

Closes: #52
Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent dbe5f742
......@@ -354,6 +354,9 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, 0, "gg", sc_navigate_index, INDEX, TOP, NULL);
girara_shortcut_add(gsession, 0, 0, "G", sc_navigate_index, INDEX, BOTTOM, NULL);
/* Presentation mode */
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
......
......@@ -983,6 +983,19 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument,
gboolean is_valid_path = TRUE;
switch(argument->n) {
case TOP:
gtk_tree_path_free(path);
path = gtk_tree_path_new_first();
break;
case BOTTOM:
gtk_tree_path_free(path);
path = gtk_tree_path_new_from_indices(gtk_tree_model_iter_n_children(model, NULL) - 1, -1);
gtk_tree_model_get_iter(model, &iter, path);
while (gtk_tree_model_iter_has_child(model, &iter) == TRUE &&
gtk_tree_view_row_expanded(tree_view, path) == TRUE) {
gtk_tree_path_append_index(path, gtk_tree_model_iter_n_children(model, &iter) - 1);
}
break;
case UP:
if (gtk_tree_path_prev(path) == FALSE) {
/* For some reason gtk_tree_path_up returns TRUE although we're not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment