diff --git a/config.def.h b/config.def.h index 14be650..1d0c92f 100644 --- a/config.def.h +++ b/config.def.h @@ -36,8 +36,8 @@ Shortcut shortcuts[] = { {GDK_CONTROL_MASK, GDK_u, sc_adjust_window, -1, { ADJUST_WIDTH } }, {GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, -1, { .data = "/" } }, {GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, -1, { .data = "?" } }, - {GDK_SHIFT_MASK, GDK_j, sc_navigate, -1, { NEXT } }, - {GDK_SHIFT_MASK, GDK_k, sc_navigate, -1, { PREVIOUS } }, + {0, GDK_J, sc_navigate, -1, { NEXT } }, + {0, GDK_K, sc_navigate, -1, { PREVIOUS } }, {0, GDK_Escape, sc_abort, -1, {0} }, {0, GDK_i, sc_change_mode, NORMAL, { INSERT } }, {0, GDK_v, sc_change_mode, NORMAL, { VISUAL } }, diff --git a/zathura.c b/zathura.c index ded3a23..842dde8 100644 --- a/zathura.c +++ b/zathura.c @@ -475,14 +475,14 @@ setCompletionRowColor(GtkBox* results, int mode, int id) void set_page(int page) { - if(page > Zathura.PDF.number_of_pages || page < 1) + if(page > Zathura.PDF.number_of_pages || page < 0) { notify(WARNING, "Could not open page"); return; } Zathura.PDF.page_number = page; - Zathura.State.pages = g_strdup_printf("[%i/%i]", page, Zathura.PDF.number_of_pages); + Zathura.State.pages = g_strdup_printf("[%i/%i]", page + 1, Zathura.PDF.number_of_pages); } /* shortcut implementation */ @@ -529,7 +529,20 @@ sc_focus_inputbar(Argument* argument) void sc_navigate(Argument* argument) { + if(!Zathura.PDF.document) + return; + int number_of_pages = Zathura.PDF.number_of_pages; + int new_page = Zathura.PDF.page_number; + + if(argument->n == NEXT) + new_page = (new_page + number_of_pages + 1) % number_of_pages; + else if(argument->n == PREVIOUS) + new_page = (new_page + number_of_pages - 1) % number_of_pages; + + set_page(new_page); + + update_status(); } void @@ -928,7 +941,7 @@ cmd_open(int argc, char** argv) Zathura.PDF.file = file; Zathura.State.filename = file; - set_page(1); + set_page(0); update_status();