From 89b654dc56b38a332e5bc4f82109152e21f0a5b6 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 5 Jan 2015 12:23:41 +0100 Subject: [PATCH] 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! --- source/blender/editors/space_file/filesel.c | 5 ++++- source/blender/editors/space_file/space_file.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index bba5981b3b8..3e663275dcd 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 bb55b643be8..f0555933146 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,