diff --git a/.gitignore b/.gitignore index 79e0a803..5a2e88cd 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ subprojects/girara # development files .clang_complete .lvimrc -*.vim .ropeproject .frama-c compile_commands.json diff --git a/zathura/commands.c b/zathura/commands.c index 8dc0f5c1..cbb877bc 100644 --- a/zathura/commands.c +++ b/zathura/commands.c @@ -413,6 +413,7 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t* unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document); unsigned int current_page_number = zathura_document_get_current_page_number(zathura->document); + zathura->global.total_search_results = 0; zathura->global.current_search_result = 0; @@ -590,7 +591,7 @@ bool cmd_exec(girara_session_t* session, girara_list_t* argument_list) { const char* bus_name = zathura_dbus_get_name(zathura); for (size_t idx = 0; idx != girara_list_size(argument_list); ++idx) { char* value = girara_list_nth(argument_list, idx); - char* s = girara_replace_substring(value, "$DBUS", bus_name); + char* s = girara_replace_substring(value, "$DBUS", bus_name); if (s != NULL) { girara_list_set_nth(argument_list, idx, s); } @@ -598,14 +599,14 @@ bool cmd_exec(girara_session_t* session, girara_list_t* argument_list) { } if (zathura->document != NULL) { - const char* path = zathura_document_get_path(zathura->document); + const char* path = zathura_document_get_path(zathura->document); unsigned int page = zathura_document_get_current_page_number(zathura->document); char page_buf[G_ASCII_DTOSTR_BUF_SIZE]; g_ascii_dtostr(page_buf, G_ASCII_DTOSTR_BUF_SIZE, page + 1); for (size_t idx = 0; idx != girara_list_size(argument_list); ++idx) { char* value = girara_list_nth(argument_list, idx); - char* r = girara_replace_substring(value, "$PAGE", page_buf); + char* r = girara_replace_substring(value, "$PAGE", page_buf); if (r != NULL) { char* s = girara_replace_substring(r, "$FILE", path); g_free(r); diff --git a/zathura/shortcuts.c b/zathura/shortcuts.c index 86d8690e..a23cab95 100644 --- a/zathura/shortcuts.c +++ b/zathura/shortcuts.c @@ -23,7 +23,6 @@ #include "adjustment.h" #include "database.h" #include -#include /* Helper function for highlighting the links */ static bool draw_links(zathura_t* zathura) { @@ -979,6 +978,7 @@ bool sc_search(girara_session_t* session, girara_argument_t* argument, girara_ev char* tmp = g_strdup_printf(" Search: [%d/%d]", zathura->global.current_search_result, zathura->global.total_search_results); girara_statusbar_item_set_text(zathura->ui.session, zathura->ui.statusbar.search_count, tmp); + g_free(tmp); } else if (argument->data != NULL) { const char* input = argument->data; char* escaped_text = g_markup_printf_escaped(_("Pattern not found: %s"), input); diff --git a/zathura/zathura.c b/zathura/zathura.c index 9fb346cb..d8d8dccd 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -1809,10 +1809,9 @@ void zathura_set_log_level(const char* loglevel) { } void zathura_modify_current_search_result(zathura_t* zathura, int diff) { - if (zathura->global.total_search_results == 0) - return; - if (diff == 0) - return; + if (zathura->global.total_search_results == 0) return; + + if (diff == 0) return; int current = zathura->global.current_search_result; int total = zathura->global.total_search_results; diff --git a/zathura/zathura.h b/zathura/zathura.h index b6eb0221..6f9410d2 100644 --- a/zathura/zathura.h +++ b/zathura/zathura.h @@ -142,7 +142,6 @@ struct zathura_s { bool double_click_follow; /**< Double/Single click to follow link */ int current_search_result; /**< The current search counter */ int total_search_results; /**< The total search results count */ - } global; struct { @@ -492,4 +491,5 @@ void zathura_modify_current_search_result(zathura_t* zathura, int diff); * @param current_page_number The current page number */ void zathura_set_current_search_result_previous_pages(zathura_t* zathura, unsigned int current_page_number); + #endif // ZATHURA_H