Changeset 320 for trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
- Timestamp:
- 06/15/07 05:15:03 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m
r319 r320 12 12 #include <unistd.h> 13 13 #import "ICeCoffEESuper.h" 14 #import "ICeCoffEESe tServicesMenu.h"14 #import "ICeCoffEEServices.h" 15 15 #import "ICeCoffEETrigger.h" 16 16 … … 344 344 ICCF_Delimiters(&urlLeftDelimiters, &urlRightDelimiters); 345 345 346 expandFront: 346 347 // XXX instead of 0, make this stop at the max URL length to prevent protracted searches 348 349 // XXX here's how this is supposed to work: 350 // (http://web.sabi.net/) and <http://web.sabi.net/> should work if they are the entire document, even if clicking at the end/beginning of the document, not barfing with "no URL" (correct, as now) or selecting the final >, or ) (what would happen if we remove this "add 1" accommodation). But how about "http://web.sabi.net/(foo)"? That should work too, as long as it's not preceded by a (. 351 // Should probably backport to ICeCoffEETerminal, now I finally understand the method to this madness. 347 352 // add 1 to range to trap delimiters that are on the edge of the selection (i.e., <...) 348 353 delimiterRange = [s rangeOfCharacterFromSet: urlLeftDelimiters … … 357 362 range.length += range.location - delimiterRange.location - 1; 358 363 range.location = delimiterRange.location + 1; 359 } 360 364 365 // in url/(parens)stuff, handle clicking inside or after (parens). 366 if ([s characterAtIndex: delimiterRange.location] == '(' && 367 range.location > 2 /* prevent wrapping, ordinarily not necessary */) { 368 if ([s rangeOfString: @")" options: NSLiteralSearch range: range].location != NSNotFound || 369 [s rangeOfCharacterFromSet: [NSCharacterSet characterSetWithCharactersInString: @"/."] 370 options: NSLiteralSearch range: range].location == NSNotFound) { 371 range.location -= 2; 372 range.length += 2; 373 ICLog(@"expanding past (, now |%@|", [s substringWithRange: range]); 374 goto expandFront; 375 } 376 } 377 } 378 361 379 ICCF_CheckRange(range); 362 380 381 expandBack: 363 382 // XXX instead of length of string, make this stop at the max URL length to prevent protracted searches 364 383 // add 1 to range to trap delimiters that are on the edge of the selection (i.e., ...>) … … 374 393 NSCAssert(delimiterRange.length == 1, @"Internal error: delimiter matched range is not of length 1"); 375 394 range.length += delimiterRange.location - range.location - range.length; 395 396 // grow URL past closing paren if we've seen an open paren 397 if ([s characterAtIndex: delimiterRange.location] == ')' && 398 [s rangeOfString: @"(" options: NSLiteralSearch range: range].location != NSNotFound) { 399 range.length += 2; 400 ICLog(@"expanding past ), now |%@|", [s substringWithRange: range]); 401 goto expandBack; 402 } 376 403 } 377 404 … … 436 463 437 464 // returns YES if menu contains useful items, NO otherwise 438 BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu, NSDictionary *serviceOptions, NSDictionary *serviceInfo) {465 static BOOL ICCF_ConsolidateServicesMenu(NSMenu *menu, NSDictionary *serviceOptions, NSDictionary *serviceInfo) { 439 466 [menu update]; // doesn't propagate to submenus, so we need to do this first 440 467 NSEnumerator *enumerator = [[menu itemArray] objectEnumerator]; … … 453 480 } else if ( (submenu = [menuItem submenu]) != nil) { 454 481 // XXX don't rely on nil-sending working 455 shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu, [itemOptions objectForKey: (NSString *)kICServiceSubmenu], itemInfo);482 shouldKeepItem = ICCF_ConsolidateServicesMenu(submenu, [itemOptions objectForKey: (NSString *)kICServiceSubmenu], [itemInfo objectForKey: (NSString *)kICServiceSubmenu]); 456 483 if (shouldKeepItem && [submenu numberOfItems] == 1) { // consolidate 457 484 NSMenuItem *serviceItem = [[submenu itemAtIndex: 0] retain];
Note:
See TracChangeset
for help on using the changeset viewer.