From 2d13e1089898b949288ae3c99ff707be267132fa Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Wed, 30 Dec 2009 00:55:03 +0100 Subject: [PATCH] Jump to begin/end/page --- config.def.h | 1 + zathura.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config.def.h b/config.def.h index ac9728e..955ffb7 100644 --- a/config.def.h +++ b/config.def.h @@ -87,6 +87,7 @@ Command commands[] = { BufferCommand buffer_commands[] = { /* regex, function, argument */ {"^gg$", bcmd_goto, { TOP } }, + {"^G$", bcmd_goto, { BOTTOM } }, {"^[0-9]+G$", bcmd_goto, {0} }, {"^zI$", bcmd_zoom, { ZOOM_IN } }, {"^zO$", bcmd_zoom, { ZOOM_OUT } }, diff --git a/zathura.c b/zathura.c index 5eb8373..738081d 100644 --- a/zathura.c +++ b/zathura.c @@ -1217,17 +1217,17 @@ void bcmd_goto(char* buffer, Argument* argument) { int b_length = strlen(buffer); - if(b_length < 1) return; - char* b_value = g_strndup(buffer, b_length - 1); - int value = atoi(b_value); + if(!strcmp(buffer, "gg")) + set_page(0); + else if(!strcmp(buffer, "G")) + set_page(Zathura.PDF.number_of_pages - 1); + else + set_page(atoi(g_strndup(buffer, b_length - 1)) - 1); - set_page(value - 1); update_status(); - - g_free(b_value); } void