[Bf-blender-cvs] [89b654d] master: FileBrowser: small tweak to new search feature: clear that string when changing dir.

Bastien Montagne noreply at git.blender.org
Mon Jan 5 12:24:59 CET 2015


Commit: 89b654dc56b38a332e5bc4f82109152e21f0a5b6
Author: Bastien Montagne
Date:   Mon Jan 5 12:23:41 2015 +0100
Branches: master
https://developer.blender.org/rB89b654dc56b38a332e5bc4f82109152e21f0a5b6

FileBrowser: small tweak to new search feature: clear that string when changing dir.

In 99% of cases, you do not want to keep the same filter when changing dir,
and having to reset it by hand is *very* annoying!

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

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

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

diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index bba5981..3e66327 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -603,9 +603,12 @@ void file_change_dir(bContext *C, int checkdir)
 	SpaceFile *sfile = CTX_wm_space_file(C);
 
 	if (sfile->params) {
-
 		ED_fileselect_clear(wm, sfile);
 
+		/* Clear search string, it is very rare to want to keep that filter while changing dir,
+		 * and usually very annoying to keep it actually! */
+		sfile->params->filter_search[0] = '\0';
+
 		if (checkdir && !BLI_is_dir(sfile->params->dir)) {
 			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
 			/* could return but just refresh the current dir */
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index bb55b64..f055593 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -199,7 +199,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
 	if (!sfile->files) {
 		sfile->files = filelist_new(params->type);
 		filelist_setdir(sfile->files, params->dir);
-		params->active_file = -1; // added this so it opens nicer (ton)
+		params->active_file = -1; /* added this so it opens nicer (ton) */
 	}
 	filelist_setsorting(sfile->files, params->sort);
 	filelist_setfilter_options(sfile->files, params->flag & FILE_HIDE_DOT,




More information about the Bf-blender-cvs mailing list