Changeset 435 for trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
- Timestamp:
- 03/04/08 17:29:41 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
r388 r435 224 224 NSRange range = [self selectedRange]; 225 225 NSCAssert(range.location != NSNotFound, ICCF_LocalizedString(@"There is no insertion point or selection in the text field where you clicked")); 226 227 if (range.length == 0) { 228 if (range.location == length) range.location--; 229 range.length = 1; 230 range = ICCF_URLEnclosingRange(s, range); 231 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 232 } 233 234 if (ICCF_LaunchURL([s substringWithRange: range], ICCF_KeyboardAction(triggeringEvent)) && ICCF_prefs.textBlinkEnabled) { 226 NSString *url = nil; 227 228 if ([[self textStorage] attribute: NSLinkAttributeName atIndex: range.location 229 effectiveRange: NULL] != nil) { 230 NSRange linkRange; 231 id link = [[self textStorage] attribute: NSLinkAttributeName atIndex: range.location longestEffectiveRange: &linkRange inRange: NSMakeRange(0, length)]; 232 if (NSMaxRange(range) <= NSMaxRange(linkRange)) { 233 // selection is entirely within link range 234 url = [link isKindOfClass: [NSURL class]] ? [link absoluteString] : link; 235 range = linkRange; 236 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 237 } 238 } 239 if (url == nil) { 240 if (range.length == 0) { 241 if (range.location == length) range.location--; 242 range.length = 1; 243 range = ICCF_URLEnclosingRange(s, range); 244 [self setSelectedRange: range affinity: NSSelectionAffinityDownstream stillSelecting: NO]; 245 } 246 247 url = [s substringWithRange: range]; 248 } 249 250 if (ICCF_LaunchURL(url, ICCF_KeyboardAction(triggeringEvent)) && ICCF_prefs.textBlinkEnabled) { 235 251 for (unsigned i = 0 ; i < ICCF_prefs.textBlinkCount ; i++) { 236 252 NSRange emptyRange = {range.location, 0}; … … 384 400 } 385 401 386 387 402 @implementation ICeCoffEE 388 403 … … 412 427 NSMenu *myMenu = [super menuForEvent: e]; 413 428 return ICCF_MenuForEvent(self, myMenu, e); 429 } 430 431 static BOOL ICCF_inMouseDown; 432 433 - (void)clickedOnLink:(id)link atIndex:(unsigned)charIndex; 434 { 435 if (!ICCF_inMouseDown) 436 [super clickedOnLink: link atIndex: charIndex]; 414 437 } 415 438 … … 428 451 429 452 if (ICCF_enabled && ICCF_prefs.commandClickEnabled && ICCF_EventIsCommandMouseDown(downEvent)) { 430 [super mouseDown: ICCF_MouseDownEventWithModifierFlags(downEvent, YES)]; 453 ICCF_inMouseDown = YES; 454 @try { 455 [super mouseDown: ICCF_MouseDownEventWithModifierFlags(downEvent, YES)]; 456 } @finally { 457 ICCF_inMouseDown = NO; 458 } 431 459 // we don't actually get a mouseUp event, just wait for mouseDown to return 432 460 NSEvent *upEvent = [[self window] currentEvent];
Note:
See TracChangeset
for help on using the changeset viewer.