mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-12 19:03:10 +03:00
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 <slavazanko@gmail.com>
This commit is contained in:
parent
da9eda40a9
commit
fb00cfc95a
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user