diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index fbf8fc330e..89f16785ea 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -242,6 +242,7 @@ MMLoginShellArgument login shell parameter [string] MMLoginShellCommand which shell to use to launch Vim [string] MMNoFontSubstitution disable automatic font substitution [bool] MMNoTitleBarWindow hide title bar [bool] +MMShareFindPboard share search text to Find Pasteboard [bool] MMShowAddTabButton enable "add tab" button on tabline [bool] MMTabMaxWidth maximum width of a tab [int] MMTabMinWidth minimum width of a tab [int] diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 50d0e3ddcd..cf00cdfb67 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -234,6 +234,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [NSNumber numberWithBool:YES], MMNativeFullScreenKey, [NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey, [NSNumber numberWithBool:NO], MMUseCGLayerAlwaysKey, + [NSNumber numberWithBool:YES], MMShareFindPboardKey, nil]; [[NSUserDefaults standardUserDefaults] registerDefaults:dict]; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index 25ccffeb96..5f7ddbf30a 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -1544,10 +1544,14 @@ // See gui_macvim_add_to_find_pboard() for an explanation of these // types. - if ([bestType isEqual:VimFindPboardType]) + if ([bestType isEqual:VimFindPboardType]) { query = [pb stringForType:VimFindPboardType]; - else - query = [pb stringForType:NSStringPboardType]; + } else { + BOOL shareFindPboard = [[NSUserDefaults standardUserDefaults] + boolForKey:MMShareFindPboardKey]; + if (shareFindPboard) + query = [pb stringForType:NSStringPboardType]; + } } NSString *input = nil; diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 6371e1b664..2a8a53f588 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -314,6 +314,9 @@ extern NSString *MMLogToStdErrKey; // (techincally this is a user default but should not be used as such). extern NSString *MMNoWindowKey; +// Argument used to control MacVim sharing search text via the Find Pasteboard. +extern NSString *MMShareFindPboardKey; + extern NSString *MMAutosaveRowsKey; extern NSString *MMAutosaveColumnsKey; extern NSString *MMRendererKey; diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index 3c971caf1a..b9fdeb43c9 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -118,6 +118,8 @@ NSString *MMLogToStdErrKey = @"MMLogToStdErr"; // (techincally this is a user default but should not be used as such). NSString *MMNoWindowKey = @"MMNoWindow"; +NSString *MMShareFindPboardKey = @"MMShareFindPboard"; + NSString *MMAutosaveRowsKey = @"MMAutosaveRows"; NSString *MMAutosaveColumnsKey = @"MMAutosaveColumns"; NSString *MMRendererKey = @"MMRenderer"; diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 6a1445a1ad..1bc03b67f6 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -36,6 +36,7 @@ static int MMDefaultFontSize = 11; static int MMMinFontSize = 6; static int MMMaxFontSize = 100; +static BOOL MMShareFindPboard = YES; static GuiFont gui_macvim_font_with_name(char_u *name); static int specialKeyToNSKey(int key); @@ -198,6 +199,15 @@ gui_macvim_after_fork_init() // signs. use_graphical_sign = (val == MMRendererCoreText); } + + // Check to use the Find Pasteboard. + MMShareFindPboard = CFPreferencesGetAppBooleanValue((CFStringRef)MMShareFindPboardKey, + kCFPreferencesCurrentApplication, + &keyValid); + if (!keyValid) { + // Share text via the Find Pasteboard by default. + MMShareFindPboard = YES; + } } @@ -1816,7 +1826,8 @@ gui_macvim_add_to_find_pboard(char_u *pat) // The second entry will be used by other applications when taking entries // off the Find pasteboard, whereas MacVim will use the first if present. [pb setString:s forType:VimFindPboardType]; - [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; + if (MMShareFindPboard) + [pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType]; } void