Last Comment Bug 247837 - Trigger autocomplete options for url using down arrow key.
: Trigger autocomplete options for url using down arrow key.
Status: RESOLVED FIXED
: fixed1.8.1
Product: Camino Graveyard
Classification: Graveyard
Component: Location Bar & Autocomplete (show other bugs)
: unspecified
: PowerPC Mac OS X
-- enhancement (vote)
: Camino1.5
Assigned To: froodian (Ian Leue)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-20 13:59 PDT by dirocco
Modified: 2007-03-31 18:03 PDT (History)
7 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Uses command-down to trigger autocomplete (4.62 KB, patch)
2006-07-21 21:19 PDT, froodian (Ian Leue)
no flags Details | Diff | Splinter Review
Uses the down key to trigger autocomplete (when already at the end of location bar) (8.34 KB, patch)
2006-07-23 02:34 PDT, froodian (Ian Leue)
stuart.morgan+bugzilla: review-
Details | Diff | Splinter Review
Moves logic into AutoCompleteTextField (2.75 KB, patch)
2006-08-07 21:47 PDT, froodian (Ian Leue)
hwaara: review-
Details | Diff | Splinter Review
Addresses hwaara's comments (5.13 KB, patch)
2006-08-28 14:15 PDT, froodian (Ian Leue)
hwaara: review-
Details | Diff | Splinter Review
r=hwaara patch (5.21 KB, patch)
2006-08-28 14:39 PDT, froodian (Ian Leue)
froodian: review+
Details | Diff | Splinter Review
Patch (5.03 KB, patch)
2006-08-29 22:33 PDT, froodian (Ian Leue)
mikepinkerton: superreview+
Details | Diff | Splinter Review

Description User image dirocco 2004-06-20 13:59:25 PDT
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040517 Camino/0.8b
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040517 Camino/0.8b

Say there are two pages that you like to visit on the same site.  After visiting
the shorter one, like http://www.theweathernetwork.ca, and reading its content,
the user should be able to click the location bar and hit the down arrow key to
see more autocomplete options for the address that's already there, like
http://www.theweathernetwork.com/weather/cities/can/Pages/CAON0728.htm.


Reproducible: Always
Steps to Reproduce:
1.
2.
3.




I also tried this with the build labelled 2004061608 but didn't want to restart
my browser to copy the ID information.
Comment 1 User image Stuart Morgan 2004-06-20 19:59:48 PDT
To make sure I understand: the behavior you want is for clicking in the URL bar
to trigger autocomplete, rather than only doing it with typing (in order not to
have to delete a letter to get autocomplete)?
Comment 2 User image Denis Heraud 2004-10-17 01:08:53 PDT
Indeed this would be a very helpful behavior. Don't know how many times a day I drag, click, erase and 
choose an entry... simply clicking the current URL and seeing all relevant URL's would be great.
Comment 3 User image Jasper 2004-10-21 14:23:13 PDT
Confirming as harmless enhancment.
Comment 4 User image Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-03-09 16:54:05 PST
(In reply to comment #3)
> Confirming as harmless enhancment.

Harmless this most certainly is not....

This is a very bad idea for reasons of platform consistency.  In Mac OS X single-line text fields, down arrow is the standard for "move the cursor to the end of the field".

This is one of the things I find most annoying about the Fx implementation, as I like to down-arrow and then start typing (i.e., at cb.o, down-arrow so I can add support/docs/proxy to the url).

Breaking platform conventions in some places and not others will confuse users and is really bad UI design/behavior; it's certainly not worth it here to save a few users *1* keystroke (to dirty the field before down-arrow works).

I'm not mortally opposed to adding a *different* keybinding to invoke autocomplete on the current (clean) url if this is really a warranted behavior (or even for a hidden pref, although I'd prefer a keybinding to hidden-pref-land), but our autocomplete behavior is the most sane, easy-to-use, and perfect of any brower I've ever tried, so I am very much opposed to changing the *default* behavior or breaking the standard text editing behaviors in a clean field.

(Note we've filed bug 329673, among others, to fix text behaviors so they behave properly elsewhere.)
Comment 5 User image Håkan Waara 2006-03-09 17:07:09 PST
I always type one character, just to get some results for the current page. Too bad we can't use the down-arrow, since that is most natural (as it is done in other browsers).

Does anyone have an idea of a near-intuitive key that would show autocompletion in this situation?
Comment 6 User image froodian (Ian Leue) 2006-07-17 14:28:38 PDT
Is there a good reason not to use cmd-down?
Comment 7 User image froodian (Ian Leue) 2006-07-21 21:19:10 PDT
Created attachment 230229 [details] [diff] [review]
Uses command-down to trigger autocomplete
Comment 8 User image Stuart Morgan 2006-07-21 21:59:40 PDT
So... why is pressing command-down, which isn't at all discoverable and takes two hands to do, better than deleting the last character?
Comment 9 User image Stuart Morgan 2006-07-21 22:02:41 PDT
What about using the down arrow only when the cursor is at the end?  Click at the end and press down, or click anywhere and press down twice, to get auto-completions.
Comment 10 User image froodian (Ian Leue) 2006-07-23 02:34:45 PDT
Created attachment 230313 [details] [diff] [review]
Uses the down key to trigger autocomplete (when already at the end of location bar)

This patch contains a very hackish bit of code in BrowserWindow.mm, which unfortunately I'm too tired to explain (it being 5:30 AM), but which luckily is documented pretty well.

Besides that, basically what we want to do is retain current behavior if the cursor isn't at the end of the location bar, or if the autocomplete options are already showing.  This does exactly that.
Comment 11 User image Stuart Morgan 2006-08-06 00:22:37 PDT
Comment on attachment 230313 [details] [diff] [review]
Uses the down key to trigger autocomplete (when already at the end of location bar)


>+  // This is an ugly hack.  For some unknown reason, |performKeyEquivalent:| is called twice for every down-arrow
>+  // keydown.

Once is keydown, once is keyup. You can just check for the event being a keydown instead of the hack.


Before getting into specifics of the rest: is there a reason this can't be done inside of AutoCompleteTextField?
Comment 12 User image froodian (Ian Leue) 2006-08-07 21:47:43 PDT
Created attachment 232660 [details] [diff] [review]
Moves logic into AutoCompleteTextField

Thanks for figuring out why performKeyEquivalent was being called twice, it was really bugging me.  Of course, now that this is in AutoCompleteTextField (and can use MoveDown:), it eliminates that problem... ;)
Comment 13 User image Håkan Waara 2006-08-28 11:52:22 PDT
Comment on attachment 232660 [details] [diff] [review]
Moves logic into AutoCompleteTextField

* Why are you modifying the string in the status bar (removing whitespace)?

* Please rename |startSearchWithDownArrow| to |maybeStartSearchWithDownArrow| to reflect its function better.

* I think your endOfBarIsSelected can be a simplified a bit by doing:
  o Check if the length is 0 (no selection)
  o Check if the location is the length of the string value of the textfield.
Comment 14 User image Håkan Waara 2006-08-28 11:53:01 PDT
By "modifying the string" I mean: "modifying the string before you use it".
Comment 15 User image froodian (Ian Leue) 2006-08-28 14:15:58 PDT
Created attachment 235791 [details] [diff] [review]
Addresses hwaara's comments

(In reply to comment #13)
> (From update of attachment 232660 [details] [diff] [review] [edit])
> * Why are you modifying the string in the status bar (removing whitespace)?

No good reason.  Removed.

I also made a couple new whitespace changes, replacing tabs with spaces.  Sorry for the clutter it introduces.
Comment 16 User image Håkan Waara 2006-08-28 14:24:17 PDT
Comment on attachment 235791 [details] [diff] [review]
Addresses hwaara's comments

Sorry, just some minor nits I caught now:

* You can simply return |endOfBarIsSelected|
* Please rename it to |caretIsAtEndOfBar| or something
* Also put a small comment above the method on what criteria it will trigger autocomplete

After that, you can mark the next patch r=me.
Comment 17 User image froodian (Ian Leue) 2006-08-28 14:39:53 PDT
Created attachment 235800 [details] [diff] [review]
r=hwaara patch
Comment 18 User image Mike Pinkerton (not reading bugmail) 2006-08-29 07:11:45 PDT
+- (BOOL) maybeStartSearchWithDownArrow;

there has got to be a better name for this method.

+  if(cursorIsAtEndOfBar) {
+    [self startSearch:[self stringValue] complete:YES];

space between |if| and paren.
Comment 19 User image Håkan Waara 2006-08-29 07:28:12 PDT
(In reply to comment #18)
> +- (BOOL) maybeStartSearchWithDownArrow;
> 
> there has got to be a better name for this method.

Another approach would be to make the method simply check if the caret is at the end of the line, and rename it accordingly (caretIsAtEndOfLine?)

Then invoke the autocomplete search in the other method (where you right now just call |maybeStartSearchWithDownArrow|.
Comment 20 User image froodian (Ian Leue) 2006-08-29 22:33:30 PDT
Created attachment 236027 [details] [diff] [review]
Patch

This takes the approach in comment 19 (since I'd already renamed the method once, and if you're having to name a method three times, maybe it's a sign that you could be solving the problem more elegantly)
Comment 21 User image Mike Pinkerton (not reading bugmail) 2006-09-11 06:40:41 PDT
Comment on attachment 236027 [details] [diff] [review]
Patch

sr=pink
Comment 22 User image froodian (Ian Leue) 2006-09-11 20:14:41 PDT
Checked in on trunk and 1.8branch.
Comment 23 User image Samuel Sidler (old account; do not CC) 2007-03-31 18:03:54 PDT
Moving fixed "1.2" bugs to 1.1 where they were really fixed. Filter on CaminoFixed1.1 for bugmail purposes.

Note You need to log in before you can comment on or make changes to this bug.