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!
This commit is contained in:
Bastien Montagne 2015-01-05 12:23:41 +01:00
parent caf5a325b0
commit 89b654dc56
2 changed files with 5 additions and 2 deletions

@ -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 */

@ -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,