From 64af4886d62a783e502c602efb7fa6ffcff2abed Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 22 Aug 2012 16:53:16 +0300 Subject: [PATCH] Ticket #2835: Fixed duplicate entities in panel with 'tree view' mode Steps to reproduce: * run mc * go to 'F9 -> left/right panel -> Tree' Expected result: unique directory names. Actual result: duplicate directory names (one name with leading slash, second directory name without leading slash). Signed-off-by: Slava Zanko --- src/filemanager/treestore.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/filemanager/treestore.c b/src/filemanager/treestore.c index 25bb7ae51..3be4ef7fd 100644 --- a/src/filemanager/treestore.c +++ b/src/filemanager/treestore.c @@ -458,7 +458,7 @@ tree_store_add_entry (const vfs_path_t * name) /* Calculate attributes */ new->name = vfs_path_clone (name); - new->sublevel = vfs_path_tokens_count (new->name) + 1; + new->sublevel = vfs_path_tokens_count (new->name); { const char *new_name; @@ -466,6 +466,8 @@ tree_store_add_entry (const vfs_path_t * name) new->subname = strrchr (new_name, '/'); if (new->subname == NULL) new->subname = new_name; + else + new->subname++; } if (new->next) submask = new->next->submask; @@ -484,18 +486,6 @@ tree_store_add_entry (const vfs_path_t * name) current = current->prev; } - /* The entry has now been added */ - - if (new->sublevel > 1) - { - /* Let's check if the parent directory is in the tree */ - vfs_path_t *tmp_vpath; - - tmp_vpath = vfs_path_vtokens_get (new->name, 0, new->sublevel - 1); - tree_store_add_entry (tmp_vpath); - vfs_path_free (tmp_vpath); - } - tree_store_dirty (TRUE); return new; } -- 2.11.4.GIT