On 03.05.2007, at 13:42, Allan Odgaard wrote:
On 2. May 2007, at 10:23, Hans-Joerg Bibiko wrote:
- 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 ...
Actually, I think escape should abort the entire thing.
I agree, but if you use my way it does the same.
- \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
I cannot reproduce this. What text are you testing with?
I was wrong. Not \n\n is the problem but a line like " \n" or "\t\n". If I don't replace the \n the snippet matching is wrong after such a line.
German example (TM_GSPELL_LANG = de) -comment out str = str.gsub(/\n/, " ") in my script
Text: Dies ist ein Tesst.\n \n Dies istt ein Test.\n
(second line is SPACE\n) invoke the script Tesst is highlighted, press TAB and now 'tt e' highlighted instead of istt. If you replace \n everything is fine.
- 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.
hmm… you can always undo. If Google is right >50% of the time, I think always accepting, and require an undo, is better than showing a pop-up.
OK - undo is also fine ;)
For security reason the command returns the snippet: new_str + "${0:}"
Huh?
What do you mean with 'Huh?'? Huh - I forgot it or I don't understand why? If the second is right: If you don't write + "${0:}" and you come to last misspelled word and press TAB you will replace the last highlighted word with TAB instead of jumping to the end. You don't know that this word is last misspelled word. ;)
Attached the modified script.
Hans