mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Improve algorithm to find root when using reveal in file browser
The algorithm will avoid changing root when possible. If root has to be changed, we favor the current project folder, if that is not possible, we use the parent for the item being selected, unless the item is in a file package below the project folder, in that case, we use the root of the file package.
This commit is contained in:
@@ -354,26 +354,26 @@ static bool is_binary (std::string const& path)
|
||||
|
||||
if(!alreadyVisible)
|
||||
{
|
||||
BOOL isChild = NO;
|
||||
for(NSURL* currentURL = ParentForURL(aURL); currentURL; currentURL = ParentForURL(currentURL))
|
||||
{
|
||||
if([currentURL isEqual:_url] || [currentURL isEqual:parentURL])
|
||||
{
|
||||
parentURL = currentURL;
|
||||
isChild = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL isChild = NO;
|
||||
for(NSURL* currentURL = ParentForURL(aURL); currentURL && !isChild; currentURL = ParentForURL(currentURL))
|
||||
if(isChild)
|
||||
{
|
||||
if([parentURL isEqual:currentURL])
|
||||
isChild = YES;
|
||||
|
||||
if([currentURL isFileURL] && (path::info([[currentURL path] fileSystemRepresentation]) & path::flag::package))
|
||||
for(NSURL* currentURL = ParentForURL(aURL); currentURL; currentURL = ParentForURL(currentURL))
|
||||
{
|
||||
parentURL = currentURL;
|
||||
isChild = YES;
|
||||
break;
|
||||
if([currentURL isFileURL] && (path::info([[currentURL path] fileSystemRepresentation]) & path::flag::package))
|
||||
{
|
||||
parentURL = currentURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
[self goToURL:isChild ? parentURL : ParentForURL(aURL)];
|
||||
|
||||
Reference in New Issue
Block a user