|
63 | 63 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
64 | 64 |
|
65 | 65 | NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
| 66 | +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
| 67 | + NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, |
| 68 | + NSPasteboardTypeString, nil]; |
| 69 | +#else |
66 | 70 | NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
|
67 | 71 | NSStringPboardType, nil];
|
| 72 | +#endif |
68 | 73 | NSString *bestType = [pb availableTypeFromArray:supportedTypes];
|
69 | 74 | if (!bestType) goto releasepool;
|
70 | 75 |
|
|
76 | 81 | /* This type should consist of an array with two objects:
|
77 | 82 | * 1. motion type (NSNumber)
|
78 | 83 | * 2. text (NSString)
|
79 |
| - * If this is not the case we fall back on using NSStringPboardType. |
| 84 | + * If this is not the case we fall back on using NSPasteboardTypeString. |
80 | 85 | */
|
81 | 86 | id plist = [pb propertyListForType:VimPboardType];
|
82 | 87 | if ([plist isKindOfClass:[NSArray class]] && [plist count] == 2)
|
|
92 | 97 |
|
93 | 98 | if (!string)
|
94 | 99 | {
|
95 |
| - /* Use NSStringPboardType. The motion type is detected automatically. |
| 100 | + /* Use NSPasteboardTypeString. The motion type is detected automatically. |
96 | 101 | */
|
| 102 | +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
| 103 | + NSMutableString *mstring = |
| 104 | + [[pb stringForType:NSPasteboardTypeString] mutableCopy]; |
| 105 | +#else |
97 | 106 | NSMutableString *mstring =
|
98 | 107 | [[pb stringForType:NSStringPboardType] mutableCopy];
|
| 108 | +#endif |
99 | 109 | if (!mstring) goto releasepool;
|
100 | 110 |
|
101 | 111 | /* Replace unrecognized end-of-line sequences with \x0a (line feed). */
|
|
178 | 188 |
|
179 | 189 | /* See clip_mch_request_selection() for info on pasteboard types. */
|
180 | 190 | NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
| 191 | +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
| 192 | + NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, |
| 193 | + NSPasteboardTypeString, nil]; |
| 194 | +#else |
181 | 195 | NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType,
|
182 | 196 | NSStringPboardType, nil];
|
| 197 | +#endif |
183 | 198 | [pb declareTypes:supportedTypes owner:nil];
|
184 | 199 |
|
185 | 200 | NSNumber *motion = [NSNumber numberWithInt:motion_type];
|
186 | 201 | NSArray *plist = [NSArray arrayWithObjects:motion, string, nil];
|
187 | 202 | [pb setPropertyList:plist forType:VimPboardType];
|
188 | 203 |
|
| 204 | +#ifdef AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER |
| 205 | + [pb setString:string forType:NSPasteboardTypeString]; |
| 206 | +#else |
189 | 207 | [pb setString:string forType:NSStringPboardType];
|
| 208 | +#endif |
190 | 209 |
|
191 | 210 | [string release];
|
192 | 211 | }
|
|
0 commit comments