• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

BathyScapheで画像のインラインプレビューを可能にするプラグイン


Commit MetaInfo

Revisãoa58185f4049019b6dcc070cd52fa94b81e7256d1 (tree)
Hora2014-02-02 12:11:08
Autormasakih <masakih@user...>
Commitermasakih

Mensagem de Log

[Fix] 連続したリンクをクリックすると複数のリンクが開かれる問題を解消

Mudança Sumário

Diff

--- a/BSInlinePreviewer.m
+++ b/BSInlinePreviewer.m
@@ -132,18 +132,26 @@ static NSString *ThumbnailSizeKey = @"com.masakih.BSInlinePreviewer.thumbnailSiz
132132 NSTextStorage *ts = [self targetTextStorage];
133133
134134 NSRange limit;
135- if(charIndex_ > 100) {
136- limit = NSMakeRange(charIndex_ - 100, 200);
135+ const NSInteger searchLength = 200;
136+ if(charIndex_ > searchLength / 2) {
137+ limit = NSMakeRange(charIndex_ - searchLength / 2, searchLength);
137138 } else {
138- limit = NSMakeRange(0, 200);
139+ limit = NSMakeRange(0, searchLength);
139140 }
140141 NSUInteger over = NSMaxRange(limit) - [ts length];
141142 if(over > 0) {
142143 limit.length -= over;
143144 }
144145 NSArray *links = [self linksForRange:limit];
145-
146- [self downloadAndInsertImages:links];
146+
147+ NSArray *array = nil;
148+ for(BSILinkInfomation *info in links) {
149+ if(NSLocationInRange(charIndex_, info.range)) {
150+ array = @[info];
151+ break;
152+ }
153+ }
154+ if(array) [self downloadAndInsertImages:array];
147155
148156 return YES;
149157 }