mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-04 02:06:01 +01:00
compare case insensitive
This commit is contained in:
parent
a5829b87ef
commit
2f5a7a3998
1 changed files with 12 additions and 1 deletions
13
completion.c
13
completion.c
|
@ -15,6 +15,17 @@
|
||||||
#include <girara/utils.h>
|
#include <girara/utils.h>
|
||||||
#include <girara/datastructures.h>
|
#include <girara/datastructures.h>
|
||||||
|
|
||||||
|
static int
|
||||||
|
compare_case_insensitive(const char* str1, const char* str2)
|
||||||
|
{
|
||||||
|
char* ustr1 = g_utf8_casefold(str1, -1);
|
||||||
|
char* ustr2 = g_utf8_casefold(str2, -1);
|
||||||
|
int res = g_utf8_collate(ustr1, ustr2);
|
||||||
|
g_free(ustr1);
|
||||||
|
g_free(ustr2);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static girara_list_t*
|
static girara_list_t*
|
||||||
list_files(zathura_t* zathura, const char* current_path, const char* current_file, int current_file_length, bool is_dir)
|
list_files(zathura_t* zathura, const char* current_path, const char* current_file, int current_file_length, bool is_dir)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +35,7 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)g_strcmp0,
|
girara_list_t* res = girara_sorted_list_new2((girara_compare_function_t)compare_case_insensitive,
|
||||||
(girara_free_function_t)g_free);
|
(girara_free_function_t)g_free);
|
||||||
|
|
||||||
/* read files */
|
/* read files */
|
||||||
|
|
Loading…
Reference in a new issue