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:
authorCampbell Barton <ideasman42@gmail.com>2013-06-19 15:53:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-19 15:53:48 +0400
commit9d4cc7885dce3237b98e282d79a589f288c6310c (patch)
treeddba42e16846da05589e70e84360c725f1849af0 /source/blender/editors/space_file/filesel.c
parent15016873ab74634cf0a1cde0adab8f981ce9e117 (diff)
fix for filesel autocomplete, it had the annoying behavior if you entered in a non-existing name, of executing it and then asking to add the dir.
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r--source/blender/editors/space_file/filesel.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 59801796f8c..a31af851575 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -638,9 +638,10 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche
return match;
}
-void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
+bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile = CTX_wm_space_file(C);
+ bool change = false;
/* search if str matches the beginning of name */
if (str[0] && sfile->files) {
@@ -675,20 +676,25 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
}
closedir(dir);
- autocomplete_end(autocpl, str);
- if (BLI_exists(str)) {
- BLI_add_slash(str);
- }
- else {
- BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
+ change = autocomplete_end(autocpl, str);
+ if (change) {
+ if (BLI_exists(str)) {
+ BLI_add_slash(str);
+ }
+ else {
+ BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
+ }
}
}
}
+
+ return change;
}
-void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
+bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile = CTX_wm_space_file(C);
+ bool change = false;
/* search if str matches the beginning of name */
if (str[0] && sfile->files) {
@@ -702,8 +708,9 @@ void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
autocomplete_do_name(autocpl, file->relname);
}
}
- autocomplete_end(autocpl, str);
+ change = autocomplete_end(autocpl, str);
}
+ return change;
}
void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile)