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