Closed
Bug 507653
Opened 16 years ago
Closed 1 year ago
Smartly truncate URLs in autocomplete window
Categories
(Camino Graveyard :: Location Bar & Autocomplete, enhancement)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: dan.j.weber, Assigned: dan.j.weber)
References
Details
Attachments
(1 file)
|
3.49 KB,
patch
|
stuart.morgan+bugzilla
:
review-
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/528.17
Build Identifier:
Instead of using NSLineBreakByTruncatingTail or NSLineBreakByTruncatingMiddle in the AutoCompleteCell to deal with long URLs, we should cut out the least pertinent parts of the URL first. For example:
http://www.example.com/first/second/third/index.html
should become (as the window gets smaller and smaller):
www.example.com/first/second/third/index.html
www.example.com/.../second/third/index.html
www.example.com/.../third/index.html
www.example.com/.../index.html
When the URL has been shortened as much as possible in this way, revert to using NSLineBreakByTruncatingMiddle on the last form of the URL;
www.exampl...index.html
Any other suggestions are welcome.
Reproducible: Always
Updated•16 years ago
|
Assignee: nobody → dan.j.weber
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: 495490
Attachment #392172 -
Flags: review?(stuart.morgan+bugzilla)
Comment 2•16 years ago
|
||
Comment on attachment 392172 [details] [diff] [review]
Patch 1
First, as a general note, make this whole thing a category method in NSString+Utils, taking the string, attributes, and target width (just make it clear in the comment for it that it may return a string that is longer than the target width if it can't do a good job trimming). That will also let you switch from heavily nested ifs to early returns.
>+ if (scheme) {
>+ NSRange schemeRange = [url rangeOfString:scheme];
>+ url = [url substringFromIndex:NSMaxRange(schemeRange) + 3];
I know this was my suggestion, but I'm starting to have second thoughts. Do we really want to remove the ability to distinguish between http and https versions of a page? And if we only do http, https URLs will probably look really weird.
>+ path = [NSString stringWithFormat:@"%@%@%@", [path substringToIndex:startLoc], [path rangeOfString:@"â¦"].location == NSNotFound ? @"â¦" : @"", [path substringFromIndex:endLoc]];
No non-ASCII in source files; use ellipsisString from our NSString+Utils.
Attachment #392172 -
Flags: review?(stuart.morgan+bugzilla) → review-
Stuart, how far from shippable was this patch? Obviously it needs to be restructured to fit your comments, but was it otherwise doing the right thing? This is another item that came up in forum feedback.
Flags: camino2.1.1?
Flags: camino2.1.2?
Flags: camino2.1.1?
Flags: camino2.1.1-
You need to log in
before you can comment on or make changes to this bug.
Description
•