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 5bbd8faf9364a52501d28b9a4b1dff27c832917e
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Tue Feb 3 13:33:51 2026 +0000

    typebuf - fix complete to use common options substring
---
 TODO.md               |  1 -
 src/efm/efm.c         |  2 --
 src/efm/efm_typebuf.c | 18 ++++++++++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/TODO.md b/TODO.md
index e856b66..1ab843c 100644
--- a/TODO.md
+++ b/TODO.md
@@ -18,7 +18,6 @@
   * Status - icon overlay label, icon, progress, busy spinner
   * Status - progress/busy spinner + label + icon
   * Dialog - label + icon + entry + buttons (ok/cancel etc.)
-* Typebuf select/filter/cmd
 * Choose fs abstraction dir setup etc.
 * Filesystem info (df like with total available)
 * Remember scroll pos, view size/pos
diff --git a/src/efm/efm.c b/src/efm/efm.c
index 410e572..8ee91ec 100644
--- a/src/efm/efm.c
+++ b/src/efm/efm.c
@@ -8,7 +8,6 @@
 #include "Evas.h"
 #include "cmd.h"
 #include "efm.h"
-#include "efm_icon.h"
 #include "efm_structs.h"
 #include "efm_util.h"
 #include "efm_dnd.h"
@@ -17,7 +16,6 @@
 #include "efm_private.h"
 #include "efm_key.h"
 #include "efm_typebuf.h"
-#include "eina_stringshare.h"
 
 int _log_dom = -1;
 
diff --git a/src/efm/efm_typebuf.c b/src/efm/efm_typebuf.c
index ad3d1d2..435faa9 100644
--- a/src/efm/efm_typebuf.c
+++ b/src/efm/efm_typebuf.c
@@ -140,8 +140,8 @@ _complete_dir(const char *str)
   Eina_File_Direct_Info *info;
   size_t                 len = strlen(str);
   char                  *dir = ecore_file_dir_get(str);
-  char                  *ret = NULL, *s;
-  Eina_List             *opts = NULL;
+  char                  *ret = NULL, *s, *s1, *s2;
+  Eina_List             *opts = NULL, *l;
 
   if (!dir) return NULL;
   it = eina_file_direct_ls(dir);
@@ -165,7 +165,6 @@ _complete_dir(const char *str)
                 eina_strbuf_free(buf);
               }
           }
-        break;
       }
   }
   eina_iterator_free(it);
@@ -173,7 +172,18 @@ done:
   free(dir);
   opts = eina_list_sort(opts, 0, (Eina_Compare_Cb)_cb_complete_dir_sort);
   // take first result in sorted list
-  ret  = opts->data;
+  ret = opts->data;
+  // walk all options and find initial string that is common
+  len = strlen(ret); // common lengthis length of first stre we found - this
+  // ultimately len will be the shortest common lenght
+  EINA_LIST_FOREACH(opts, l, s)
+  {
+    // walk first string and this string until they are not the same
+    for (s1 = ret, s2 = l->data; (*s1 == *s2) && (*s1) && (*s2); s1++, s2++);
+    // if string walked is less than current len = shorten it
+    if ((s1 - ret) < len) len = s1 - ret;
+  }
+  ret[len] = 0; // truncate returned string to min common length
   opts->data = ""
   // free out tmp list of options
   EINA_LIST_FREE(opts, s) free(s);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to