Word Breaks For Nerds

August 24th, 2011

Those of us who do a lot of typing on Macs are familiar with a variety of keyboard shortcuts for navigating lines, words, and characters in text editors that use standard “Cocoa key bindings.”

Among those common keyboard shortcuts are cmd-arrow to move to the beginning or end of a line, and option-arrow to move between words in a sentence.

Starting in Lion, Apple fine-tuned the behavior by changing the definition of what constitutes a word delimiter for option-arrow navigation. While it used to stop on e.g. period-separated words, now it considers such chains.of.words to be a single “word.”  My friend Mike Ash noticed this and, when he complained about it to me, I set about finding a solution.

It turns out there’s a supported preference setting to alter this behavior. Look in your System Preferences under the Langage & Text pane, and you’ll find a “Word Breaks” setting with various options, including a special one just for nerds:

Language  Text

For most people, the “Standard” setting is probably the right choice. But computer programmers are far more likely to encounter words that are separated by syntactic characters such as periods, colons, etc. For us, it makes more sense to have the system pause at these word breaks than to breeze right by them.

Updates:

  1. You should take note that after changing the setting, you won’t notice changes in applications until they have been quit and relaunched again.
  2. As noted in the comments, this feature was apparently available in 10.6 as well, and was possible more along the lines of the default in 10.5 and previous. The growing consensus seems to be that it was in the update from 10.6 to 10.7 that a previous selection of this setting was not preserved.

 

7 Responses to “Word Breaks For Nerds”

  1. Ian Beck Says:

    This isn’t actually new in Lion (believe I first started using this setting in 10.5; not sure when it was added, though). What’s new is that Lion forgets the setting when you upgrade to it from Snow Leopard.

  2. Martin Pilkington Says:

    Shame it doesn’t give you the control-arrow support for moving through components of a camel case word. I actually miss that more outside of Xcode’s main editor than the incorrect word jump.

  3. Troy Gilbert Says:

    Actually, Snow Leopard was the first time I encountered this. Not sure if it was introduced here, but on new Snow Leopard machines I had to make this change (new Leopard machines didn’t require this change).

  4. Lri Says:

    Part of middle of word in Standard: .:_’
    Not part of end of word in Standard: +=`^$|
    Part of middle of word in English (United States, Computer): _’
    Not part of end of word in English (United States, Computer): +=`^$|

    So the only difference I could find between those settings (with printable ASCII characters) is that in Computer dot and colon aren’t treated as middle-of-word characters.

    I didn’t see any difference between 10.6.8 and 10.7.1. The default behavior used to be (more?) like Computer in 10.3 and earlier. (http://hints.macworld.com/article.php?story=2006050817551646)

  5. Lri Says:

    < and > should’ve been included in the end of word characters in both settings, but were eated by HTML.

  6. Smokey Ardisson Says:

    One of the interesting (read: annoying) things about this was that on 10.6, Safari’s location bar was bound to use “English (United States, Computer)”–but not any other places in Safari that “spoke URL”, like the Bookmarks manager. (Presumably this continues on 10.7 as well, though I haven’t heard.)

    When 10.6 came out, we had a number of complaints that double-click word selection no longer worked “properly” in Camino’s location bar, but it still did in Safari’s. Once we investigated and discovered Safari’s location bar-only special casing, we suggested users who wanted the old period-as-word-separator switch to “English (United States, Computer)” rather than us coding into Camino inconsistencies between selection in UI elements that “spoke URL” (like the location bar and Bookmarks) and other places where a user might type or paste a URL, like a web page text field (or, worse, e.g. with a <title>-less page that is bookmarked, between a bookmark’s title field and URL field).

    This recommendation has been profoundly unsatisfying for me, though, because it means that anyone who wants the old period-as-word-separator behavior, even if their native language is not “English (United States)”, has to switch away from their native word-breaking to the Computer dialect of “English (United States)”, for the entire OS. I’m not sure what’s worse, an inconsistency for everyone between selection in various places one might find a URL, or non-US English speakers losing their native word-breaking behavior.

    And, really, Standard vs Computer seems completely backwards; in standard US English, a period is, with the exception of decimal numbers, always the end of a word (ditto a colon); I don’t know why Apple moved these two to “middle-of-the-word” characters in “Standard” English!?

  7. rsfinn Says:

    Actually, in common usage, abbreviations like “U.S.” probably ought to be considered single words. Perhaps that’s why Apple made the change.

Comments are Closed.

Follow the Conversation

Stay up-to-date by subscribing to the Comments RSS Feed for this entry.