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:
@@ -603,9 +603,12 @@ void file_change_dir(bContext *C, int checkdir)
|
|||||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||||
|
|
||||||
if (sfile->params) {
|
if (sfile->params) {
|
||||||
|
|
||||||
ED_fileselect_clear(wm, sfile);
|
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)) {
|
if (checkdir && !BLI_is_dir(sfile->params->dir)) {
|
||||||
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
|
BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
|
||||||
/* could return but just refresh the current 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) {
|
if (!sfile->files) {
|
||||||
sfile->files = filelist_new(params->type);
|
sfile->files = filelist_new(params->type);
|
||||||
filelist_setdir(sfile->files, params->dir);
|
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_setsorting(sfile->files, params->sort);
|
||||||
filelist_setfilter_options(sfile->files, params->flag & FILE_HIDE_DOT,
|
filelist_setfilter_options(sfile->files, params->flag & FILE_HIDE_DOT,
|
||||||
|
Reference in New Issue
Block a user