diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-04 00:05:32 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-04 00:15:31 +0300 |
commit | 197653e08749b8fd3a5cbec212438df391b8b41c (patch) | |
tree | c01fac580eaad9951e994f6c529177c9defa4b53 /source/blender/editors/space_file/filelist.c | |
parent | 5ba0ce854410b51b6d0db3adb826259949f41f18 (diff) |
Fix selecting multiple files ignoring first file
E.g. box selecting wouldn't allow selecting the first file.
Work selection and shift/ctrl selection had similar issues.
Code assumed that the first item was the '..' parent item and manually
removed it from the selection. I could just remove this special
handling, but instead I made the behavior more dynamic. So the file list
checks if the '..' item is there and only then applies special
treatment.
That way we can easily bring the '..' item back or make it optional if
wanted.
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index fdc101f3d82..46302e0d087 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2299,6 +2299,19 @@ unsigned int filelist_entry_select_index_get(FileList *filelist, return 0; } +/** + * Set selection of the '..' parent entry, but only if it's actually visible. + */ +void filelist_entry_parent_select_set(FileList *filelist, + FileSelType select, + unsigned int flag, + FileCheckType check) +{ + if ((filelist->filter_data.flags & FLF_HIDE_PARENT) == 0) { + filelist_entry_select_index_set(filelist, 0, select, flag, check); + } +} + /* WARNING! dir must be FILE_MAX_LIBEXTRA long! */ bool filelist_islibrary(struct FileList *filelist, char *dir, char **group) { |