Don’t pre-select (find) “in selection” by default

Previously this would be selected if the user had a multi-line selection and was pressing ⌘F. The old behavior can be restored using:

    defaults write findInSelectionByDefault -bool YES
This commit is contained in:
Allan Odgaard
2013-06-20 21:52:52 +07:00
parent 6b64f38053
commit b835952823

View File

@@ -32,6 +32,7 @@
namespace find_tags { enum { in_document = 1, in_selection, in_project, in_folder }; } // From AppController.h
static NSString* const kUserDefaultsFindInSelectionByDefault = @"findInSelectionByDefault";
static NSString* const OakDocumentPboardType = @"OakDocumentPboardType"; // dragndrop of tabs
static BOOL IsInShouldTerminateEventLoop = NO;
@@ -1782,7 +1783,7 @@ namespace
find.projectIdentifier = self.identifier;
NSInteger mode = [sender respondsToSelector:@selector(tag)] ? [sender tag] : find_tags::in_document;
if(mode == find_tags::in_document && [self.window isKeyWindow] && self.textView.hasMultiLineSelection)
if(mode == find_tags::in_document && [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsFindInSelectionByDefault] && [self.window isKeyWindow] && self.textView.hasMultiLineSelection)
mode = find_tags::in_selection;
switch(mode)