Changeset 1111 for trunk


Ignore:
Timestamp:
Nov 19, 2006, 10:20:35 PM (15 years ago)
Author:
livings124
Message:

even better url completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1110 r1111  
    729729    {
    730730        if ([urlString rangeOfString: @"://"].location == NSNotFound)
    731             urlString = [@"http://" stringByAppendingString: urlString];
    732        
    733         if ([urlString rangeOfString: @"."].location == NSNotFound)
    734         {
    735             int start = NSMaxRange([urlString rangeOfString: @"://"]);
    736             int beforeCom;
    737             if ((beforeCom = [urlString rangeOfString: @"/" options: 0
    738                                 range: NSMakeRange(start, [urlString length] - start)].location) != NSNotFound)
    739                 urlString = [NSString stringWithFormat: @"%@www.%@.com/%@", [urlString substringToIndex: start],
    740                                     [urlString substringWithRange: NSMakeRange(start, beforeCom - start)],
     731        {
     732            if ([urlString rangeOfString: @"."].location == NSNotFound)
     733            {
     734                int beforeCom;
     735                if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
     736                    urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
     737                                    [urlString substringToIndex: beforeCom],
    741738                                    [urlString substringFromIndex: beforeCom + 1]];
     739                else
     740                    urlString = [NSString stringWithFormat: @"http://www.%@.com", urlString];
     741            }
    742742            else
    743                 urlString = [NSString stringWithFormat: @"%@www.%@.com", [urlString substringToIndex: start],
    744                                     [urlString substringFromIndex: start]];
     743                urlString = [@"http://" stringByAppendingString: urlString];
    745744        }
    746745       
Note: See TracChangeset for help on using the changeset viewer.