File Browser: Two more minor fixes for arrow keys selection
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 12 Jun 2015 04:25:43 +0000 (06:25 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 12 Jun 2015 04:25:43 +0000 (06:25 +0200)
* Unset active file on opening/resetting file list
* Accidentally placed NULL check in the middle of the function - not a
big deal as it's highly unlikely that it fails (removed it but added
assert)

source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filesel.c

index 4889b7758495599b014e4c887e2e182f9c50c752..db93000ef7c261b6171ca7f47138556b6e15a11f 100644 (file)
@@ -476,6 +476,8 @@ static bool file_walk_select_selection_set(
        int active = active_old; /* could use active_old instead, just for readability */
        bool deselect = false;
 
+       BLI_assert(params);
+
        if (has_selection) {
                if (extend &&
                    filelist_is_selected(files, active_old, FILE_SEL_SELECTED) &&
@@ -512,7 +514,7 @@ static bool file_walk_select_selection_set(
                }
        }
 
-       if (!params || active < 0) {
+       if (active < 0) {
                return false;
        }
 
index 05786139845037538bef256f583da5d65b55d426..66eb79abae213d32aa48ae089fe40fa710276f67 100644 (file)
@@ -250,6 +250,7 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 
        /* operator has no setting for this */
        params->sort = FILE_SORT_ALPHA;
+       params->active_file = -1;
 
 
        /* initialize the list with previous folders */
@@ -283,6 +284,7 @@ void ED_fileselect_reset_params(SpaceFile *sfile)
        sfile->params->type = FILE_UNIX;
        sfile->params->flag = 0;
        sfile->params->title[0] = '\0';
+       sfile->params->active_file = -1;
 }
 
 int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar)