diff --git a/commands.c b/commands.c index f88fcf7..c98c10b 100644 --- a/commands.c +++ b/commands.c @@ -107,7 +107,6 @@ cmd_close(girara_session_t* session, girara_list_t* UNUSED(argument_list)) g_return_val_if_fail(session->global.data != NULL, false); zathura_t* zathura = session->global.data; if (zathura->document == NULL) { - // nothing needs to be done return true; } @@ -192,15 +191,13 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list) if (argc > 2) { girara_notify(session, GIRARA_ERROR, "Too many arguments."); return false; - } - else if (argc >= 1) { + } else if (argc >= 1) { if (zathura->document) { document_close(zathura); } document_open(zathura, girara_list_nth(argument_list, 0), (argc == 2) ? girara_list_nth(argument_list, 1) : NULL); - } - else { + } else { girara_notify(session, GIRARA_ERROR, "No arguments given."); return false; } @@ -239,8 +236,7 @@ cmd_save(girara_session_t* session, girara_list_t* argument_list) if (girara_list_size(argument_list) == 1) { document_save(zathura, girara_list_nth(argument_list, 0), false); - } - else { + } else { girara_notify(session, GIRARA_ERROR, "Invalid number of arguments."); return false; } @@ -262,8 +258,7 @@ cmd_savef(girara_session_t* session, girara_list_t* argument_list) if (girara_list_size(argument_list) == 1) { document_save(zathura, girara_list_nth(argument_list, 0), true); - } - else { + } else { girara_notify(session, GIRARA_ERROR, "Invalid number of arguments."); return false; } diff --git a/shortcuts.c b/shortcuts.c index 085c4f2..ab09794 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -230,19 +230,19 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int } GtkAdjustment* adjustment = NULL; - if ( (argument->n == LEFT) || (argument->n == RIGHT) ) + if ( (argument->n == LEFT) || (argument->n == RIGHT) ) { adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); - else + } else { adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view)); + } - gdouble view_size = gtk_adjustment_get_page_size(adjustment); - gdouble value = gtk_adjustment_get_value(adjustment); - gdouble max = gtk_adjustment_get_upper(adjustment) - view_size; + gdouble view_size = gtk_adjustment_get_page_size(adjustment); + gdouble value = gtk_adjustment_get_value(adjustment); + gdouble max = gtk_adjustment_get_upper(adjustment) - view_size; gdouble scroll_step = 40; + gdouble new_value = value; - gdouble new_value; - switch(argument->n) - { + switch(argument->n) { case FULL_UP: new_value = (value - view_size) < 0 ? 0 : (value - view_size); break; @@ -270,7 +270,7 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument, unsigned int new_value = max; break; default: - new_value = 0; + new_value = value; } gtk_adjustment_set_value(adjustment, new_value); @@ -309,7 +309,7 @@ sc_navigate_index(girara_session_t* session, girara_argument_t* argument, GtkTreePath *path; gtk_tree_view_get_cursor(tree_view, &path, NULL); - if(path == NULL) { + if (path == NULL) { return false; }