Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-05 18:17:09 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-05 23:05:02 +0300
commit8858311463b7220eef383781d31dde31868fcd7c (patch)
tree8e065129ce3fa6979d5a44719444676fbdb4afa2 /source/blender/editors/space_file/file_ops.c
parentd31b2f854954838fb849b5b0be0011d792eecb43 (diff)
Fix T58715: File Browser: Creating "New Folder" issues with too many existing folders in display.
Smotthscroll to edited entry was broken since filelisting was rewritten to become async...
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index a6d52b8fb45..450c3177f92 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -1581,7 +1581,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
ARegion *ar, *oldar = CTX_wm_region(C);
int offset;
int numfiles, numfiles_layout;
- int edit_idx = 0;
+ int edit_idx = -1;
int i;
/* escape if not our timer */
@@ -1590,6 +1590,13 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
numfiles = filelist_files_ensure(sfile->files);
+ /* Due to async nature of file listing, we may execute this code before `file_refresh()`
+ * editing entry is available in our listing, so we also have to handle switching to rename mode here. */
+ FileSelectParams *params = ED_fileselect_get_params(sfile);
+ if (params->renamefile[0] != '\0') {
+ file_params_renamefile_activate(sfile, params);
+ }
+
/* check if we are editing a name */
for (i = 0; i < numfiles; ++i) {
if (filelist_entry_select_index_get(sfile->files, i, CHECK_ALL) ) {
@@ -1599,9 +1606,13 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
}
/* if we are not editing, we are done */
- if (0 == edit_idx) {
- WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
- sfile->smoothscroll_timer = NULL;
+ if (edit_idx == -1) {
+ /* Do not invalidate timer if filerename is still pending, we might still be building the filelist
+ * and yet have to find edited entry... */
+ if (params->renamefile[0] == '\0') {
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), sfile->smoothscroll_timer);
+ sfile->smoothscroll_timer = NULL;
+ }
return OPERATOR_PASS_THROUGH;
}
@@ -1671,7 +1682,6 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
void FILE_OT_smoothscroll(wmOperatorType *ot)
{
-
/* identifiers */
ot->name = "Smooth Scroll";
ot->idname = "FILE_OT_smoothscroll";