mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Update search and file chooser to new glob list
This commit is contained in:
@@ -233,18 +233,6 @@ NSString* const FolderOptionsDefaultsKey = @"Folder Search Options";
|
||||
{
|
||||
case FindActionFindAll:
|
||||
{
|
||||
NSString* glob = controller.globString;
|
||||
if([glob isEqualToString:@"*"])
|
||||
glob = @"{.,}*";
|
||||
|
||||
std::string excludeGlob = "";
|
||||
if(![controller.searchIn isEqualToString:FFSearchInOpenFiles])
|
||||
{
|
||||
static std::string const excludeKeys[] = { kSettingsExcludeInFolderSearchKey, kSettingsExcludeKey };
|
||||
for(size_t i = 0; i < sizeofA(excludeKeys) && excludeGlob == ""; ++i)
|
||||
excludeGlob = settings_for_path(NULL_STR, "", to_s(controller.searchFolder)).get(excludeKeys[i], "");
|
||||
}
|
||||
|
||||
FFDocumentSearch* folderSearch = [[FFDocumentSearch new] autorelease];
|
||||
folderSearch.searchString = controller.findString;
|
||||
folderSearch.options = findOptions;
|
||||
@@ -255,7 +243,19 @@ NSString* const FolderOptionsDefaultsKey = @"Folder Search Options";
|
||||
}
|
||||
else
|
||||
{
|
||||
find::folder_scan_settings_t search([controller.searchIn isEqualToString:FFSearchInOpenFiles] ? find::folder_scan_settings_t::open_files : to_s(controller.searchFolder), [glob UTF8String], excludeGlob, controller.followLinks, !controller.searchHiddenFolders);
|
||||
path::glob_list_t globs;
|
||||
if(![controller.searchIn isEqualToString:FFSearchInOpenFiles])
|
||||
{
|
||||
auto const settings = settings_for_path(NULL_STR, "", to_s(controller.searchFolder));
|
||||
globs.add_exclude_glob(settings.get(kSettingsExcludeDirectoriesInFolderSearchKey, NULL_STR), path::kPathItemDirectory);
|
||||
globs.add_exclude_glob(settings.get(kSettingsExcludeFilesInFolderSearchKey, NULL_STR), path::kPathItemFile);
|
||||
for(auto key : { kSettingsExcludeInFolderSearchKey, kSettingsExcludeKey, kSettingsBinaryKey })
|
||||
globs.add_exclude_glob(settings.get(key, NULL_STR));
|
||||
globs.add_include_glob(controller.searchHiddenFolders ? "{,.}*" : "*", path::kPathItemDirectory);
|
||||
globs.add_include_glob(to_s(controller.globString), path::kPathItemFile);
|
||||
}
|
||||
|
||||
find::folder_scan_settings_t search([controller.searchIn isEqualToString:FFSearchInOpenFiles] ? find::folder_scan_settings_t::open_files : to_s(controller.searchFolder), globs, controller.followLinks);
|
||||
[folderSearch setFolderOptions:search];
|
||||
folderSettings[controller.searchFolder.UTF8String] = search;
|
||||
}
|
||||
|
||||
@@ -176,12 +176,16 @@ void file_chooser_t::set_path (std::string const& path)
|
||||
_filtered_documents.clear();
|
||||
_ranked_items.clear();
|
||||
|
||||
std::string excludeGlob = "";
|
||||
static std::string const excludeKeys[] = { kSettingsExcludeInFileChooserKey, kSettingsExcludeKey };
|
||||
for(size_t i = 0; i < sizeofA(excludeKeys) && excludeGlob == ""; ++i)
|
||||
excludeGlob = settings_for_path(NULL_STR, "", path).get(excludeKeys[i], "");
|
||||
auto const settings = settings_for_path(NULL_STR, "", path);
|
||||
path::glob_list_t globs;
|
||||
globs.add_exclude_glob(settings.get(kSettingsExcludeDirectoriesInFileChooserKey, NULL_STR), path::kPathItemDirectory);
|
||||
globs.add_exclude_glob(settings.get(kSettingsExcludeFilesInFileChooserKey, NULL_STR), path::kPathItemFile);
|
||||
for(auto key : { kSettingsExcludeInFileChooserKey, kSettingsExcludeKey, kSettingsBinaryKey })
|
||||
globs.add_exclude_glob(settings.get(key, NULL_STR));
|
||||
globs.add_include_glob("*", path::kPathItemDirectory);
|
||||
globs.add_include_glob("{,.}*", path::kPathItemFile);
|
||||
|
||||
_scanner.reset(new document::scanner_t(_path, "{,.}*", excludeGlob));
|
||||
_scanner.reset(new document::scanner_t(_path, globs));
|
||||
}
|
||||
|
||||
void file_chooser_t::add_documents (std::vector<document::document_ptr> const& documents)
|
||||
|
||||
Reference in New Issue
Block a user