BathyScapheで画像のインラインプレビューを可能にするプラグイン
| Revision | 4d81fe5fecc591ba8dcfedbc3718f09582e0e1b8 (tree) |
|---|---|
| Time | 2012-05-20 13:04:57 |
| Author | masakih <masakih@user...> |
| Commiter | masakih |
[Refactor] プロパティ名変更
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | NSTextView *_textView; |
| 17 | 17 | BSInlinePreviewerEx *_owner; |
| 18 | 18 | |
| 19 | - NSUInteger _selfAwaking; | |
| 19 | + NSUInteger _selfNotified; | |
| 20 | 20 | } |
| 21 | 21 | @property (retain) NSTextView *textView; |
| 22 | 22 | @property (assign) BSInlinePreviewerEx *owner; |
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | |
| 17 | 17 | @interface BSIPEReplacer () |
| 18 | 18 | // 画像挿入によって引き起こしたNSTextStorageDidProcessEditingNotificationの回数 |
| 19 | -@property NSUInteger selfAwaking; | |
| 19 | +@property NSUInteger selfNotified; | |
| 20 | 20 | |
| 21 | 21 | @end |
| 22 | 22 |
| @@ -24,7 +24,7 @@ | ||
| 24 | 24 | @synthesize textView = _textView; |
| 25 | 25 | @synthesize owner = _owner; |
| 26 | 26 | |
| 27 | -@synthesize selfAwaking = _selfAwaking; | |
| 27 | +@synthesize selfNotified = _selfNotified; | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | static NSMutableDictionary *instances = nil; |
| @@ -121,19 +121,20 @@ NSRange fixRange(NSRange range, NSTextStorage *ts) | ||
| 121 | 121 | range:range]; |
| 122 | 122 | |
| 123 | 123 | [ts insertAttributedString:newInsertion atIndex:range.location]; |
| 124 | - self.selfAwaking++; | |
| 124 | + self.selfNotified++; | |
| 125 | 125 | } |
| 126 | 126 | [ts endEditing]; |
| 127 | 127 | } |
| 128 | 128 | - (void)textDidChange:(NSNotification *)no |
| 129 | 129 | { |
| 130 | 130 | NSUInteger length = [[self.textView textStorage] length]; |
| 131 | + // スレッド変更チェック | |
| 131 | 132 | if(length == 0) { |
| 132 | - self.selfAwaking = 0; | |
| 133 | + self.selfNotified = 0; | |
| 133 | 134 | return; |
| 134 | 135 | } |
| 135 | - if(self.selfAwaking > 0) { | |
| 136 | - self.selfAwaking--; | |
| 136 | + if(self.selfNotified > 0) { | |
| 137 | + self.selfNotified--; | |
| 137 | 138 | return; |
| 138 | 139 | } |
| 139 | 140 |
| @@ -142,7 +143,6 @@ NSRange fixRange(NSRange range, NSTextStorage *ts) | ||
| 142 | 143 | |
| 143 | 144 | [lock lock]; |
| 144 | 145 | |
| 145 | - | |
| 146 | 146 | NSMutableArray *links = [NSMutableArray array]; |
| 147 | 147 | |
| 148 | 148 | [ts enumerateAttribute:NSLinkAttributeName |