diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-12-06 00:38:13 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-12-06 00:38:13 +0300 |
commit | 858b38f12c77acda617f07e0bfb954610b8fb56c (patch) | |
tree | 3e307d267e76119ad4349d5042829b750c5204ba /source/blender/editors/space_file | |
parent | 272973804e39358b4fdbb1e954ebcd52a2f6b152 (diff) | |
parent | ee120d6293fefec25d762b069d813440f3e54ee5 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index cca33cdd1a7..217ce8f1d9a 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -151,15 +151,25 @@ static FileSelection file_selection_get(bContext *C, const rcti *rect, bool fill /* if desired, fill the selection up from the last selected file to the current one */ if (fill && (sel.last >= 0) && (sel.last < numfiles) ) { - int f = sel.last; - while (f >= 0) { + int f; + /* Try to find a smaller-index selected item. */ + for (f = sel.last; f >= 0; f--) { if (filelist_entry_select_index_get(sfile->files, f, CHECK_ALL) ) break; - f--; } if (f >= 0) { sel.first = f + 1; } + /* If none found, try to find a higher-index selected item. */ + else { + for (f = sel.first; f < numfiles; f++) { + if (filelist_entry_select_index_get(sfile->files, f, CHECK_ALL) ) + break; + } + if (f < numfiles) { + sel.last = f - 1; + } + } } return sel; } |