support exact filename in file filter; fix action dispatching when no focus

This commit is contained in:
Vadim Lopatin 2015-01-26 17:35:03 +03:00
parent 6e1f11fd57
commit 96d19be199
2 changed files with 6 additions and 3 deletions

View File

@ -156,14 +156,15 @@ string parentDir(string path) {
return buildNormalizedPath(path, "..");
}
/// check filename with pattern (currently only *.ext pattern is supported)
/// check filename with pattern (currently only *.ext, *.* and filename.ext patterns are supported)
bool filterFilename(string filename, string pattern) {
if (pattern.equal("*.*"))
return true; // matches any
if (pattern.length < 3)
return false;
if (pattern[0] != '*' || pattern[1] != '.')
return false;
if (pattern[0] != '*' || pattern[1] != '.') {
return filename.baseName.equal(pattern);
}
return filename.endsWith(pattern[1..$]);
}

View File

@ -515,6 +515,8 @@ class Window {
return true;
focus = focus.parent;
}
if (_mainWidget)
return _mainWidget.handleAction(action);
return false;
}