[TxMt] Spell checking using Google

Hans-Joerg Bibiko bibiko at eva.mpg.de
Wed May 2 08:23:31 UTC 2007


Hi Allan,

nice coding (I'm learning Ruby step by step ;) )

Here my comments:

1) ESC behaviour
If I press ESC while the pull-down menu is shown it takes Google's  
first suggestion. By my opinion it's more logically that pressing ESC  
will change nothing. Thus I wrote:
...
res = TextMate::UI.menu(items.flatten)
correction = (res) ? res['string'] : org
...

2) \n\n problem
There's is still the problem if the selected text contains '\n\n'
I managed it by relpacing all \n with a non-used character

3) Google returns only one suggestion
>  When there is only one suggestion, the command uses that, and  
> makes the word a tab-stop.
By my opinion it would be better to show always a pull-down menu with  
the original and the suggestion. Google hasn't always right.

4)
> Personally I think the menu is generally not wanted, so that part  
> should probably be removed (and the first suggestion should always  
> be picked).
As you mentioned the popping up of many pull-down menus is a bit  
confusing because I don't know which word is currently checked.
But how about that way:

- If a single word will be checked - same behaviour (except the  
command doesn't return a snippet; it returns it as exit_replace_text)

- If a text is selected meaning at least one space is in it the  
command only returns a snippet of misspelled word without any  
changes. After that you can navigate with TAB through the snippet  
(misspelled words) and if you find a really misspelled word you can  
invoke the command again and so forth.

5)
For security reason the command returns the snippet: new_str + "${0:}"



Attached is my version of gspell.

Hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Google Spell Check Selection : Word.tmCommand
Type: application/octet-stream
Size: 2836 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070502/8764bf05/attachment.tmCommand>


More information about the textmate mailing list