Merge pull request #502 from macvim-dev/MMShareFindPboard

Control sharing the find pasteboard with defaults
This commit is contained in:
Kazuki Sakamoto
2017-05-04 18:17:14 -07:00
committed by GitHub
6 changed files with 26 additions and 4 deletions
+1
View File
@@ -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]
+1
View File
@@ -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];
+7 -3
View File
@@ -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;
+3
View File
@@ -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;
+2
View File
@@ -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";
+12 -1
View File
@@ -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