Only skip setting search folder for ⇧⌘F if already “owner”

The user may use ⇧⌘F either to bring existing results to front, or to start a new folder search for a potential different project.

If the dialog is not visible, we always initialize it fully. If already visible, we previously would not setup search folder since the current search folder might have been manually set by the user, which we do not want to overwrite.
This commit is contained in:
Allan Odgaard
2013-06-21 11:46:00 +07:00
parent d22f7163c5
commit ffae9da1d3

View File

@@ -1778,6 +1778,7 @@ namespace
- (IBAction)orderFrontFindPanel:(id)sender
{
Find* find = [Find sharedInstance];
BOOL didOwnDialog = [find.projectIdentifier isEqualToString:self.identifier];
find.documentIdentifier = self.selectedDocumentUUID;
find.projectFolder = self.projectPath ?: self.untitledSavePath ?: NSHomeDirectory();
find.projectIdentifier = self.identifier;
@@ -1796,7 +1797,7 @@ namespace
{
BOOL fileBrowserHasFocus = [self.window.firstResponder respondsToSelector:@selector(isDescendantOf:)] && [(NSView*)self.window.firstResponder isDescendantOf:self.fileBrowser.view];
NSString* searchFolder = fileBrowserHasFocus ? self.untitledSavePath : find.projectFolder;
if(find.isVisible && find.searchFolder)
if(find.isVisible && find.searchFolder && didOwnDialog) // dont reset search folder, as the user may have picked “Other…” and simply wants the results brought to front
searchFolder = find.searchFolder;
[find showFindWindowFor:searchFolder];
}