[Bf-blender-cvs] [b2bb3e4b722] blender-v3.0-release: Fix T90082: Autoscrolling after renaming in the File Browser broken

Philipp Oeser noreply at git.blender.org
Thu Nov 25 17:32:48 CET 2021


Commit: b2bb3e4b722bad7e887a66ac4a6f589b389e6dc5
Author: Philipp Oeser
Date:   Thu Nov 25 17:31:31 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBb2bb3e4b722bad7e887a66ac4a6f589b389e6dc5

Fix T90082: Autoscrolling after renaming in the File Browser broken

Caused by 6b0869039a40

Above commit introduced selection after renaming. This includes calling
`file_select_deselect_all` [which resorts and refilters].

So now, to have the correct file for scrolling, get it again after
sorting by calling `file_params_find_renamed` again.

Differential Revision: https://developer.blender.org/D13368

===================================================================

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

===================================================================

diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index c59398e0016..37b1d3825d4 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -1372,7 +1372,7 @@ void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params)
 
   BLI_assert(params->renamefile[0] != '\0' || params->rename_id != NULL);
 
-  const int idx = file_params_find_renamed(params, sfile->files);
+  int idx = file_params_find_renamed(params, sfile->files);
   if (idx >= 0) {
     FileDirEntry *file = filelist_file(sfile->files, idx);
     BLI_assert(file != NULL);
@@ -1385,7 +1385,11 @@ void file_params_renamefile_activate(SpaceFile *sfile, FileSelectParams *params)
       params->rename_flag = FILE_PARAMS_RENAME_ACTIVE;
     }
     else if ((params->rename_flag & FILE_PARAMS_RENAME_POSTSCROLL_PENDING) != 0) {
+      /* file_select_deselect_all() will resort and refilter, so idx will probably have changed.
+       * Need to get the correct FileDirEntry again. */
       file_select_deselect_all(sfile, FILE_SEL_SELECTED);
+      idx = file_params_find_renamed(params, sfile->files);
+      file = filelist_file(sfile->files, idx);
       filelist_entry_select_set(
           sfile->files, file, FILE_SEL_ADD, FILE_SEL_SELECTED | FILE_SEL_HIGHLIGHTED, CHECK_ALL);
       params->active_file = idx;



More information about the Bf-blender-cvs mailing list