changeset 14091:616dc84228b7 v8.1.0063

patch 8.1.0063: Mac: NSStringPboardType is deprecated commit https://github.com/vim/vim/commit/d595a1910c5672808e44afa028e253e47f03651f Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 17 15:01:04 2018 +0200 patch 8.1.0063: Mac: NSStringPboardType is deprecated Problem: Mac: NSStringPboardType is deprecated. Solution: Use NSPasteboardTypeString. (Akshay Hegde, closes https://github.com/vim/vim/issues/3022)
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Jun 2018 15:15:05 +0200
parents 42f2385f014a
children 5e5daac87b5d
files src/os_macosx.m src/version.c
diffstat 2 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_macosx.m
+++ b/src/os_macosx.m
@@ -63,8 +63,13 @@ clip_mch_request_selection(VimClipboard 
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
     NSPasteboard *pb = [NSPasteboard generalPasteboard];
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+    NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
+	    NSPasteboardTypeString, nil];
+#else
     NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
 	    NSStringPboardType, nil];
+#endif
     NSString *bestType = [pb availableTypeFromArray:supportedTypes];
     if (!bestType) goto releasepool;
 
@@ -76,7 +81,7 @@ clip_mch_request_selection(VimClipboard 
 	/* This type should consist of an array with two objects:
 	 *   1. motion type (NSNumber)
 	 *   2. text (NSString)
-	 * If this is not the case we fall back on using NSStringPboardType.
+	 * If this is not the case we fall back on using NSPasteboardTypeString.
 	 */
 	id plist = [pb propertyListForType:VimPboardType];
 	if ([plist isKindOfClass:[NSArray class]] && [plist count] == 2)
@@ -92,10 +97,15 @@ clip_mch_request_selection(VimClipboard 
 
     if (!string)
     {
-	/* Use NSStringPboardType.  The motion type is detected automatically.
+	/* Use NSPasteboardTypeString.  The motion type is detected automatically.
 	 */
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+	NSMutableString *mstring =
+		[[pb stringForType:NSPasteboardTypeString] mutableCopy];
+#else
 	NSMutableString *mstring =
 		[[pb stringForType:NSStringPboardType] mutableCopy];
+#endif
 	if (!mstring) goto releasepool;
 
 	/* Replace unrecognized end-of-line sequences with \x0a (line feed). */
@@ -178,15 +188,24 @@ clip_mch_set_selection(VimClipboard *cbd
 
 	/* See clip_mch_request_selection() for info on pasteboard types. */
 	NSPasteboard *pb = [NSPasteboard generalPasteboard];
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+	NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
+		NSPasteboardTypeString, nil];
+#else
 	NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
 		NSStringPboardType, nil];
+#endif
 	[pb declareTypes:supportedTypes owner:nil];
 
 	NSNumber *motion = [NSNumber numberWithInt:motion_type];
 	NSArray *plist = [NSArray arrayWithObjects:motion, string, nil];
 	[pb setPropertyList:plist forType:VimPboardType];
 
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+	[pb setString:string forType:NSPasteboardTypeString];
+#else
 	[pb setString:string forType:NSStringPboardType];
+#endif
 
 	[string release];
     }
--- a/src/version.c
+++ b/src/version.c
@@ -762,6 +762,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    63,
+/**/
     62,
 /**/
     61,