Forwarding Address: OS X

Wednesday, November 03, 2004

Word completion in Cocoa apps

It's always cool to stumble across a nifty feature in the Cocoa text editing engine, because its niftiness is multiplied across multiple applications. Did you know that option-esc calls up a word completion dialog? I didn't, though a little post-discovery Googling shows that this made the rounds of the tip sites about a year ago. Anyway, take a peek at the Edit menu in TextEdit. See the entry called "Complete"? This facility, which arrived with 10.3, uses the system spelling dictionary. So if you can't remember how to spell "pusillanimous," just type "pusi" and hit option-esc (or F5).

Now doesn't that make you feel better? No?

(If any Cocoa gurus know of a way to use this feature with a custom wordlist -- replacing, not augmenting, the built-in list -- let me know!)

5 Comments:

  • Check out NSTextView's
    textView:completions:forPartialWordRange:indexOfSelectedItem:

    You just return an array of words you want to show up in the list.

    -gus

    By Anonymous, at 3:17 PM  

  • Wow, that looks perfect -- thanks!

    By pbx, at 7:01 PM  

  • you can see an example of a customized word completion list in action in the latest CVS build of SpyChat (i don't recall if there has been a release since i introduced this in CVS)

    By Hes Nikke, at 8:56 PM  

  • Thanks!

    By pbx, at 5:37 AM  

  • Just for reference: this apparently doesn't work if one if using cocoAspell.

    bitpart

    By Anonymous, at 7:39 AM  

Post a Comment

<< Home