I have no idea why the search text was in the format of name/full/path when full/path already contains the name

This commit is contained in:
Scoopta 2019-11-21 00:09:17 -08:00
parent 5d271d5d31
commit c8d052be6a

View File

@ -26,19 +26,14 @@ void wofi_run_init() {
struct cache_line* node, *tmp; struct cache_line* node, *tmp;
wl_list_for_each_safe(node, tmp, cache, link) { wl_list_for_each_safe(node, tmp, cache, link) {
char* text; char* text;
char* search_prefix;
char* final_slash = strrchr(node->line, '/'); char* final_slash = strrchr(node->line, '/');
if(final_slash == NULL) { if(final_slash == NULL) {
text = node->line; text = node->line;
search_prefix = "";
} else { } else {
text = final_slash + 1; text = final_slash + 1;
search_prefix = text;
} }
char* search_text = utils_concat(2, search_prefix, node->line); wofi_insert_widget(MODE, &text, node->line, &node->line, 1);
wofi_insert_widget(MODE, &text, search_text, &node->line, 1);
map_put(cached, node->line, "true"); map_put(cached, node->line, "true");
free(search_text);
free(node->line); free(node->line);
wl_list_remove(&node->link); wl_list_remove(&node->link);
free(node); free(node);
@ -64,10 +59,8 @@ void wofi_run_init() {
struct stat info; struct stat info;
stat(full_path, &info); stat(full_path, &info);
if(access(full_path, X_OK) == 0 && S_ISREG(info.st_mode) && !map_contains(cached, full_path)) { if(access(full_path, X_OK) == 0 && S_ISREG(info.st_mode) && !map_contains(cached, full_path)) {
char* search_text = utils_concat(2, entry->d_name, full_path);
char* text = strdup(entry->d_name); char* text = strdup(entry->d_name);
wofi_insert_widget(MODE, &text, search_text, &full_path, 1); wofi_insert_widget(MODE, &text, full_path, &full_path, 1);
free(search_text);
free(text); free(text);
} }
free(full_path); free(full_path);