Initialize bisect state when opening document

Otherwise, when opening a document at page 1, and no jumps are added,
bisect does not understand it has to initialize the bisect range, and
does not move from page 1.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Abdó Roig-Maranges 2013-07-07 17:27:25 +02:00 committed by Sebastian Ramacher
parent 2b6fa0cfe6
commit f3229a6a5a
2 changed files with 10 additions and 1 deletions

View File

@ -722,7 +722,11 @@ sc_jumplist(girara_session_t* session, girara_argument_t* argument,
zathura_t* zathura = session->global.data; zathura_t* zathura = session->global.data;
g_return_val_if_fail(argument != NULL, false); g_return_val_if_fail(argument != NULL, false);
g_return_val_if_fail(zathura->document != NULL, false); g_return_val_if_fail(zathura->document != NULL, false);
g_return_val_if_fail(zathura->jumplist.size != 0, false);
/* if no jumps in the jumplist */
if (zathura->jumplist.size == 0) {
return;
}
GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); GtkAdjustment* hadj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); GtkAdjustment* vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));

View File

@ -654,6 +654,11 @@ document_open(zathura_t* zathura, const char* path, const char* password,
zathura_document_set_adjust_mode(document, ZATHURA_ADJUST_NONE); zathura_document_set_adjust_mode(document, ZATHURA_ADJUST_NONE);
} }
/* initialize bisect state */
zathura->bisect.start = 0;
zathura->bisect.last_jump = zathura_document_get_current_page_number(document);
zathura->bisect.end = number_of_pages - 1;
/* update statusbar */ /* update statusbar */
bool basename_only = false; bool basename_only = false;
girara_setting_get(zathura->ui.session, "statusbar-basename", &basename_only); girara_setting_get(zathura->ui.session, "statusbar-basename", &basename_only);