Jump to begin/end/page

This commit is contained in:
Moritz Lipp 2009-12-30 00:55:03 +01:00
parent 85beb0d242
commit 2d13e10898
2 changed files with 7 additions and 6 deletions

View file

@ -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 } },

View file

@ -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