Cocoa: Text field/view goodness

April 20, 2008 @ 17:39

If you’re using your keyboard for most of your navigation needs, you probably know about the standard Emacs keyboard shortcuts for navigating through a text view. No? Then go take a look, e.g. here.

Now, most of those commands (especially the cursor movement ones) are available in, to my knowledge, all Cocoa text input components. How does that sound to you? It should sound great, since in all of a sudden, navigating your search history becomes less of a pain in the ass (at least if your primary browser has a search field powered by Cocoa. How come?

Say that I’ve visited some page at this site, e.g. the one about the alarm bug in iCal. If that is the only page I’ve ever visited at this domain, and I begin typing something like:

arrel…

What do you think your browser search field will show as an auto-completion entry? Good guess:

http://arrelid.com/archive/2008/04/16/bug-ical-doesnt-always-respect-alarm-setting-on-to-do-items#respond

What if you wanted to quickly go to the top level page of my domain? Using your new (mad!) keyboard skills, you’d know that this can easily be accomplished by a few keyboard commands

  1. Control + B
  2. Control + Alt + F
  3. Control + Alt + F
  4. Control + K

A short explanation might come in handy here. (1) Moves the cursor one step to the left, and makes the current selection disappear. (2) Then moves to the cursor to the position before “.com”. Another press (3) takes you to the position right after “.com”. Finally, (4) deletes the rest of the characters on the line. Easy, and quick!

There’s zillions of uses for these keyboard shortcuts, so learn them by heart and you won’t have to reach out for your silly mouse, or the numerical keypad (or the home/end/pageup/pagedown keys).

Tags: , , , , , , ,

Leave a Reply