Skip to content

Commit

Permalink
review: Address reviewer's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
laomuon committed Aug 26, 2024
1 parent 04a763c commit 0f01136
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ subprojects/girara
# development files
.clang_complete
.lvimrc
*.vim
.ropeproject
.frama-c
compile_commands.json
Expand Down
11 changes: 6 additions & 5 deletions zathura/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ bool cmd_search(girara_session_t* session, const char* input, girara_argument_t*
/* set search direction */
zathura->global.search_direction = argument->n;

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);
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;

Expand Down Expand Up @@ -590,22 +591,22 @@ 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);
}
}
}

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);
Expand Down
2 changes: 1 addition & 1 deletion zathura/shortcuts.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "adjustment.h"
#include "database.h"
#include <math.h>
#include <unistd.h>

/* Helper function for highlighting the links */
static bool draw_links(zathura_t* zathura) {
Expand Down Expand Up @@ -980,6 +979,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);
Expand Down
7 changes: 3 additions & 4 deletions zathura/zathura.c
Original file line number Diff line number Diff line change
Expand Up @@ -1820,10 +1820,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;
Expand Down
1 change: 1 addition & 0 deletions zathura/zathura.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,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

0 comments on commit 0f01136

Please sign in to comment.