This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository edi.

View the commit online.

commit b556e4c8792e9d9dad7b3c06f7b4bd8f31874b1f
Author: Alastair Poole <[email protected]>
AuthorDate: Wed Apr 15 06:27:27 2026 +0100

    filepanel: in non-project mode show whole filesystem.
    
    EDI can run in editor-mode as a standalone text-editor. The
    code already exists to do this.
    
    This change ensures in non-project and edit mode the file
    selector uses the whole filesystem and is thus navigatable and
    much more usable as a standalone text-editor should you choose
    to open a file with EDI.
---
 src/bin/edi_filepanel.c | 44 +++++++++++++++++++++++++++++---------------
 src/bin/edi_main.c      |  2 +-
 2 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c
index 4415ab4..9ce54b2 100644
--- a/src/bin/edi_filepanel.c
+++ b/src/bin/edi_filepanel.c
@@ -657,7 +657,7 @@ _item_menu_dir_create(Evas_Object *win, Edi_Dir_Data *sd)
    if (ecore_file_app_installed("terminology"))
      elm_menu_item_add(menu, menu_it, "utilities-terminal", _("Open Terminal here"), _item_menu_open_terminal_cb, sd);
 
-   if (strcmp(sd->path, edi_project_get()))
+   if (strcmp(sd->path, _root_path))
      {
         elm_menu_item_add(menu, menu_it, "document-save-as", _("Rename Directory"), _item_menu_rename_cb, sd);
         if (ecore_file_dir_is_empty(sd->path))
@@ -689,7 +689,7 @@ _item_clicked_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
         if (!sd)
           return;
 
-        sd->path = edi_project_get();
+        sd->path = _root_path;
         sd->isdir = EINA_TRUE;
         _item_menu_dir_create(_main_win, sd);
      }
@@ -946,11 +946,14 @@ static Elm_Object_Item *_file_listing_item_find(const char *path)
 }
 
 static Eina_Bool
-_path_is_in_project(const char *path)
+_path_is_in_root(const char *path)
 {
-   size_t rootlen = strlen(edi_project_get());
+   size_t rootlen = strlen(_root_path);
 
-   if (strncmp(path, edi_project_get(), rootlen))
+   if (!strcmp(_root_path, "/"))
+     return path && path[0] == '/';
+
+   if (strncmp(path, _root_path, rootlen))
      return EINA_FALSE;
 
    return path[rootlen] == '\0' || path[rootlen] == '/';
@@ -979,10 +982,11 @@ _expand_to_path(const char *path)
    char *dir;
    char *cursor;
    char *sep;
+   const char *start;
    size_t rootlen;
    Eina_Bool ready = EINA_TRUE;
 
-   if (!_path_is_in_project(path))
+   if (!_path_is_in_root(path))
      return EINA_TRUE;
 
    dir = strdup(path);
@@ -997,14 +1001,18 @@ _expand_to_path(const char *path)
      }
    *sep = '\0';
 
-   rootlen = strlen(edi_project_get());
+   rootlen = strlen(_root_path);
    if (strlen(dir) <= rootlen)
      {
         free(dir);
         return EINA_TRUE;
      }
 
-   for (cursor = dir + rootlen + 1; *cursor; cursor++)
+   start = dir + rootlen;
+   if (*start == '/')
+     start++;
+
+   for (cursor = (char *)start; *cursor; cursor++)
      {
         if (*cursor != '/')
           continue;
@@ -1061,7 +1069,7 @@ _edi_filepanel_expand_pending_try(void)
 
    EINA_LIST_FOREACH_SAFE(_paths_expand_pending, l, l_next, path)
      {
-        if (!_path_is_in_project(path) || _expand_to_path(path))
+        if (!_path_is_in_root(path) || _expand_to_path(path))
           {
              _paths_expand_pending = eina_list_remove_list(_paths_expand_pending, l);
              eina_stringshare_del(path);
@@ -1082,7 +1090,7 @@ _edi_filepanel_select_pending_path_try(void)
         return EINA_TRUE;
      }
 
-   if (!_path_is_in_project(_path_select_pending))
+   if (!_path_is_in_root(_path_select_pending))
      {
         _edi_filepanel_select_next_best_path(_path_select_pending);
         eina_stringshare_del(_path_select_pending);
@@ -1237,17 +1245,23 @@ _file_listing_updated(void *data EINA_UNUSED, int type EINA_UNUSED,
                       void *event EINA_UNUSED)
 {
    const char *dir;
+   size_t rootlen, child_index;
    Eio_Monitor_Event *ev = event;
    Elm_Object_Item *parent_it;
 
+   rootlen = strlen(_root_path);
+   child_index = rootlen;
+   if (rootlen && _root_path[rootlen - 1] != '/')
+     child_index++;
+
    dir = ecore_file_dir_get(ev->filename);
-   if (strncmp(edi_project_get(), dir, strlen(edi_project_get())) ||
-       ev->filename[strlen(edi_project_get()) + 1] == '.' ||
+   if (strncmp(_root_path, dir, rootlen) ||
+       ev->filename[child_index] == '.' ||
        _file_path_hidden(ev->filename, EINA_FALSE))
      return EINA_TRUE;
 
    parent_it = _file_listing_item_find(dir);
-   if (!parent_it && strcmp(dir, edi_project_get()))
+   if (!parent_it && strcmp(dir, _root_path))
      return EINA_TRUE;
 
    if (type == EIO_MONITOR_FILE_CREATED)
@@ -1328,7 +1342,7 @@ _edi_filepanel_select_next_best_path(const char *path)
 
    while (1)
      {
-        if (!strcmp(try, edi_project_get()))
+        if (!strcmp(try, _root_path))
           break;
 
         end = strrchr(try, '/');
@@ -1387,7 +1401,7 @@ edi_filepanel_refresh_all(void)
    free(_root_dir);
 
    _root_dir = calloc(1, sizeof(Edi_Dir_Data));
-   _root_dir->path = edi_project_get();
+   _root_dir->path = _root_path;
 
    _edi_filepanel_expand_pending_clear();
    _paths_expand_pending = expanded_paths;
diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index 59f9ec7..d59ad75 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -1853,7 +1853,7 @@ edi_open(const char *inputpath)
    if (edi_project_mode_get())
      content = edi_content_setup(vbx, path);
    else
-     content = edi_content_setup(vbx, edi_project_get());
+     content = edi_content_setup(vbx, "/");
 
    evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL);

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

Reply via email to