This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efm2.
View the commit online.
commit 63b5f107fef3a4974461b8941edd95f3926edae5
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Tue Jan 23 20:49:16 2024 +0000
fix sorting
nocae by default. fix dir sortign where ome are links to dirs
---
src/efm/efm.c | 2 +-
src/efm/sort.c | 32 ++++++++++++++++++--------------
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/src/efm/efm.c b/src/efm/efm.c
index 1cf2298..e6d03f4 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -777,7 +777,7 @@ _smart_add(Evas_Object *obj)
sd->config.view_mode = EFM_VIEW_MODE_ICONS;
sd->config.sort_mode = EFM_SORT_MODE_NAME | EFM_SORT_MODE_LABEL_NOT_PATH
- | EFM_SORT_MODE_DIRS_FIRST;
+ | EFM_SORT_MODE_NOCASE | EFM_SORT_MODE_DIRS_FIRST;
// XXX: get this from config...
sd->config.icon_size = 40;
sd->config.detail_min_w[0] = 50;
diff --git a/src/efm/sort.c b/src/efm/sort.c
index 3250db4..8b1b25f 100644
--- a/src/efm/sort.c
+++ b/src/efm/sort.c
@@ -55,6 +55,16 @@ _str_mode(int mode, char str[11])
str[10] = 0;
}
+static const char *
+_str_path_name(const Cmd *c)
+{
+ const char *path = cmd_key_find(c, "path");
+ if (!path) return "";
+ path = strrchr(path, '/');
+ if (!path) return "";
+ return path + 1;
+}
+
static int
_sort_str_field(const Cmd *c1, const Cmd *c2,
int (*cmpfn)(const char *s1, const char *s2), const char *field)
@@ -70,10 +80,8 @@ _sort_str_field(const Cmd *c1, const Cmd *c2,
res = cmpfn(field1, field2);
if (!res)
{ // they are the same string! use pure filename path as it's unique
- path1 = cmd_key_find(c1, "path");
- if (!path1) return 0;
- path2 = cmd_key_find(c2, "path");
- if (!path2) return 0;
+ path1 = _str_path_name(c1);
+ path2 = _str_path_name(c2);
res = cmpfn(path1, path2);
if (!res) return strcmp(path1, path2);
return res;
@@ -96,10 +104,8 @@ _sort_num_field(const Cmd *c1, const Cmd *c2, const char *field)
if (field1 == field2)
{ // they are the same string! use pure filename path as it's unique
- path1 = cmd_key_find(c1, "path");
- if (!path1) return 0;
- path2 = cmd_key_find(c2, "path");
- if (!path2) return 0;
+ path1 = _str_path_name(c1);
+ path2 = _str_path_name(c2);
return strcmp(path1, path2);
}
// sort result
@@ -123,18 +129,16 @@ _sort_label(const Cmd *c1, const Cmd *c2,
// get a label instead of filename path element if available
path1 = cmd_key_find(c1, "label");
- if (!path1) path1 = cmd_key_find(c1, "path");
+ if (!path1) path1 = _str_path_name(c1);
// get a label instead of filename path element if available
path2 = cmd_key_find(c2, "label");
- if (!path2) path2 = cmd_key_find(c2, "path");
+ if (!path2) path2 = _str_path_name(c2);
res = cmpfn(path1, path2);
if (!res)
{ // they are the same string! use pure filename path as it's unique
- path1 = cmd_key_find(c1, "path");
- if (!path1) return 0;
- path2 = cmd_key_find(c2, "path");
- if (!path2) return 0;
+ path1 = _str_path_name(c1);
+ path2 = _str_path_name(c2);
res = cmpfn(path1, path2);
if (!res) return strcmp(path1, path2);
return res;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.