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 b423356880e945d4941498d56676c8cd6d16925a
Author: Alastair Poole <[email protected]>
AuthorDate: Wed Apr 15 06:11:47 2026 +0100
filepanel: keep track of state so we can restore.
Keep track of expanded paths so we don't lose state on
eio_monitor events or hide/show of the panel.
This makes the file panel much more useful as it's no longer
resetting state on hide/show and eio_monitor events. It will
also handle updates.
---
src/bin/edi_filepanel.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
src/bin/edi_filepanel.h | 9 +++++++
src/bin/edi_main.c | 6 ++++-
3 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c
index b1279d2..4415ab4 100644
--- a/src/bin/edi_filepanel.c
+++ b/src/bin/edi_filepanel.c
@@ -40,6 +40,7 @@ static regex_t _filter_regex;
static Eina_Bool _filter_set = EINA_FALSE;
static Edi_Dir_Data *_root_dir;
static const char *_path_select_pending;
+static Eina_List *_paths_expand_pending;
static Elm_Object_Item * _file_listing_item_find(const char *path);
static void _file_listing_fill(Edi_Dir_Data *dir, Elm_Object_Item *parent_it);
@@ -1043,6 +1044,31 @@ _expand_to_path(const char *path)
return ready;
}
+static void
+_edi_filepanel_expand_pending_clear(void)
+{
+ const char *path;
+
+ EINA_LIST_FREE(_paths_expand_pending, path)
+ eina_stringshare_del(path);
+}
+
+static void
+_edi_filepanel_expand_pending_try(void)
+{
+ Eina_List *l, *l_next;
+ const char *path;
+
+ EINA_LIST_FOREACH_SAFE(_paths_expand_pending, l, l_next, path)
+ {
+ if (!_path_is_in_project(path) || _expand_to_path(path))
+ {
+ _paths_expand_pending = eina_list_remove_list(_paths_expand_pending, l);
+ eina_stringshare_del(path);
+ }
+ }
+}
+
static Eina_Bool
_edi_filepanel_select_pending_path_try(void)
{
@@ -1129,6 +1155,7 @@ _ls_main_cb(void *data, Eio_File *handler, const Eina_File_Direct_Info *info)
// _signal_first(lreq);
_file_listing_item_insert(info->path, info->type == EINA_FILE_DIR, lreq->parent_it);
+ _edi_filepanel_expand_pending_try();
if (_path_select_pending && !strcmp(info->path, _path_select_pending))
_edi_filepanel_select_pending_path_try();
@@ -1140,6 +1167,7 @@ _ls_done_cb(void *data, Eio_File *handler EINA_UNUSED)
Listing_Request *lreq = data;
edi_filepanel_scm_status_update();
+ _edi_filepanel_expand_pending_try();
_edi_filepanel_select_pending_path_try();
_listing_request_cleanup(lreq);
@@ -1324,6 +1352,33 @@ _edi_filepanel_select_next_best_path(const char *path)
void
edi_filepanel_refresh_all(void)
{
+ Eina_Iterator *it;
+ Elm_Object_Item *item;
+ Edi_Dir_Data *sd;
+ Eina_List *expanded_paths = NULL;
+ const char *selected_path = NULL;
+
+ item = elm_genlist_selected_item_get(_list);
+ if (item)
+ {
+ sd = elm_object_item_data_get(item);
+ if (sd && sd->path)
+ selected_path = eina_stringshare_add(sd->path);
+ }
+
+ it = eina_hash_iterator_data_new(_list_items);
+ EINA_ITERATOR_FOREACH(it, item)
+ {
+ if (elm_genlist_item_type_get(item) != ELM_GENLIST_ITEM_TREE ||
+ !elm_genlist_item_expanded_get(item))
+ continue;
+
+ sd = elm_object_item_data_get(item);
+ if (sd && sd->path)
+ expanded_paths = eina_list_append(expanded_paths, eina_stringshare_add(sd->path));
+ }
+ eina_iterator_free(it);
+
elm_genlist_clear(_list);
eina_hash_free_buckets(_list_items);
eina_hash_free_buckets(_list_statuses);
@@ -1334,13 +1389,30 @@ edi_filepanel_refresh_all(void)
_root_dir = calloc(1, sizeof(Edi_Dir_Data));
_root_dir->path = edi_project_get();
+ _edi_filepanel_expand_pending_clear();
+ _paths_expand_pending = expanded_paths;
eina_stringshare_del(_path_select_pending);
_path_select_pending = NULL;
+ if (selected_path)
+ {
+ eina_stringshare_replace(&_path_select_pending, selected_path);
+ eina_stringshare_del(selected_path);
+ }
_file_listing_fill(_root_dir, NULL);
+ _edi_filepanel_expand_pending_try();
+ _edi_filepanel_select_pending_path_try();
elm_genlist_realized_items_update(_list);
}
+void
+edi_filepanel_restore_pending_cancel(void)
+{
+ _edi_filepanel_expand_pending_clear();
+ eina_stringshare_del(_path_select_pending);
+ _path_select_pending = NULL;
+}
+
void
edi_filepanel_select_path(const char *path)
{
diff --git a/src/bin/edi_filepanel.h b/src/bin/edi_filepanel.h
index 0937b7d..3cc5456 100644
--- a/src/bin/edi_filepanel.h
+++ b/src/bin/edi_filepanel.h
@@ -101,6 +101,15 @@ void edi_filepanel_item_update_all(void);
* @ingroup UI
*/
void edi_filepanel_refresh_all(void);
+
+/**
+ * Cancel pending async tree state restoration.
+ *
+ * Used when the file panel is toggled to avoid delayed UI jumps.
+ *
+ * @ingroup UI
+ */
+void edi_filepanel_restore_pending_cancel(void);
/**
* @}
*/
diff --git a/src/bin/edi_main.c b/src/bin/edi_main.c
index 39c25fb..59f9ec7 100644
--- a/src/bin/edi_main.c
+++ b/src/bin/edi_main.c
@@ -275,14 +275,18 @@ _edi_toggle_file_panel(void *data, Evas_Object *obj EINA_UNUSED, void *event_inf
if (size == 0.0)
{
+ edi_filepanel_restore_pending_cancel();
elm_icon_standard_set(_edi_filepanel_icon, "go-previous");
_edi_slide_panel_new(_edi_leftpanes, panel, _edi_project_config->gui.leftsize, EINA_TRUE, EINA_TRUE);
- if (_edi_filepanel_selected_path)
+ selected = edi_filepanel_selected_path_get(panel);
+ if (_edi_filepanel_selected_path &&
+ (!selected || strcmp(selected, _edi_filepanel_selected_path)))
edi_filepanel_select_path(_edi_filepanel_selected_path);
}
else
{
+ edi_filepanel_restore_pending_cancel();
selected = edi_filepanel_selected_path_get(panel);
if (selected)
eina_stringshare_replace(&_edi_filepanel_selected_path, selected);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.