diff options
author | Henrik Aarnio <hjaarnio@gmail.com> | 2013-11-19 19:31:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-19 19:42:50 +0400 |
commit | 035d86402bbb8dab2bfb086a3027e5ec93e52748 (patch) | |
tree | b41a8522214d72b40d1ff7e69d215a11880907d2 /source/blender/editors/space_file | |
parent | 0c0bed3b161ae005821cc68e56ea78223d5fe16c (diff) |
Fix: tab completing a filepath name in file browsers asks to create a new
directory if name was not fully matched
When hitting tab to complete a directory name in the filepath field in the
filebrowser Blender shows a "create new directory?" popup, if the beginning
of directory name typed in the field matches many entries. For example if you
have directories in the open directory called "test123" and "test456", typing
"te", tab would complete up to "test", but ask to create a new folder with the
name "test".
This patch unsets the boolean storing the info about changing filepath if the
folder with the completed name does not exist.
Reviewed By: brecht
Differential Revision: http://developer.blender.org/D10
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 9d762c80405..c6e1541352d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -637,7 +637,7 @@ int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matche bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile = CTX_wm_space_file(C); - bool change = false; + int match = AUTOCOMPLETE_NO_MATCH; /* search if str matches the beginning of name */ if (str[0] && sfile->files) { @@ -672,9 +672,9 @@ bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) } closedir(dir); - change = autocomplete_end(autocpl, str); - if (change) { - if (BLI_exists(str)) { + match = autocomplete_end(autocpl, str); + if (match) { + if (match == AUTOCOMPLETE_FULL_MATCH) { BLI_add_slash(str); } else { @@ -684,13 +684,13 @@ bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) } } - return change; + return match == AUTOCOMPLETE_FULL_MATCH; } bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) { SpaceFile *sfile = CTX_wm_space_file(C); - bool change = false; + int match = AUTOCOMPLETE_NO_MATCH; /* search if str matches the beginning of name */ if (str[0] && sfile->files) { @@ -704,9 +704,9 @@ bool autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v)) autocomplete_do_name(autocpl, file->relname); } } - change = autocomplete_end(autocpl, str); + match = autocomplete_end(autocpl, str); } - return change; + return match != AUTOCOMPLETE_NO_MATCH; } void ED_fileselect_clear(struct wmWindowManager *wm, struct SpaceFile *sfile) |