Mercurial > vim
comparison src/os_macosx.m @ 2909:b65a26a2aa09 v7.3.227
updated for version 7.3.227
Problem: Mac OS doesn't have the linewise clipboard fix.
Solution: Also change the Mac OS file. (Bjorn Winckler)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 20 Jun 2011 00:25:44 +0200 |
parents | acda456c788a |
children | 150576e6b984 |
comparison
equal
deleted
inserted
replaced
2908:fd09a9c8468e | 2909:b65a26a2aa09 |
---|---|
63 NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, | 63 NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, |
64 NSStringPboardType, nil]; | 64 NSStringPboardType, nil]; |
65 NSString *bestType = [pb availableTypeFromArray:supportedTypes]; | 65 NSString *bestType = [pb availableTypeFromArray:supportedTypes]; |
66 if (!bestType) goto releasepool; | 66 if (!bestType) goto releasepool; |
67 | 67 |
68 int motion_type = MCHAR; | 68 int motion_type = MAUTO; |
69 NSString *string = nil; | 69 NSString *string = nil; |
70 | 70 |
71 if ([bestType isEqual:VimPboardType]) | 71 if ([bestType isEqual:VimPboardType]) |
72 { | 72 { |
73 /* This type should consist of an array with two objects: | 73 /* This type should consist of an array with two objects: |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 if (!string) | 90 if (!string) |
91 { | 91 { |
92 /* Use NSStringPboardType. The motion type is set to line-wise if the | 92 /* Use NSStringPboardType. The motion type is detected automatically. |
93 * string contains at least one EOL character, otherwise it is set to | |
94 * character-wise (block-wise is never used). | |
95 */ | 93 */ |
96 NSMutableString *mstring = | 94 NSMutableString *mstring = |
97 [[pb stringForType:NSStringPboardType] mutableCopy]; | 95 [[pb stringForType:NSStringPboardType] mutableCopy]; |
98 if (!mstring) goto releasepool; | 96 if (!mstring) goto releasepool; |
99 | 97 |
106 { | 104 { |
107 n = [mstring replaceOccurrencesOfString:@"\x0d" withString:@"\x0a" | 105 n = [mstring replaceOccurrencesOfString:@"\x0d" withString:@"\x0a" |
108 options:0 range:range]; | 106 options:0 range:range]; |
109 } | 107 } |
110 | 108 |
111 /* Scan for newline character to decide whether the string should be | |
112 * pasted line-wise or character-wise. | |
113 */ | |
114 motion_type = MCHAR; | |
115 if (0 < n || NSNotFound != [mstring rangeOfString:@"\n"].location) | |
116 motion_type = MLINE; | |
117 | |
118 string = mstring; | 109 string = mstring; |
119 } | 110 } |
120 | 111 |
112 /* Default to MAUTO, uses MCHAR or MLINE depending on trailing NL. */ | |
121 if (!(MCHAR == motion_type || MLINE == motion_type || MBLOCK == motion_type | 113 if (!(MCHAR == motion_type || MLINE == motion_type || MBLOCK == motion_type |
122 || MAUTO == motion_type)) | 114 || MAUTO == motion_type)) |
123 motion_type = MCHAR; | 115 motion_type = MAUTO; |
124 | 116 |
125 char_u *str = (char_u*)[string UTF8String]; | 117 char_u *str = (char_u*)[string UTF8String]; |
126 int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; | 118 int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; |
127 | 119 |
128 #ifdef FEAT_MBYTE | 120 #ifdef FEAT_MBYTE |