Akatombo Web Log
Thursday, August 17, 2006
Entering Japanese in TextMate
One of the big problems with TextMate for me is the lack of ability to handle Japanese text correctly. Anyone who uses it with Japanese will know what I’m talking about. Japanese text entry can pretty much cause the application to freeze, though I find that tapping a combination of space, escape, and enter will eventually unstick it and insert a bunch of junk into my file, which I can then erase. That is the biggest problem, and is the one for which I have found a partial solution. The other problem is that it can’t seem to handle rendering the font correctly and every character starts halfway through the one proceeding it, making reading virtually impossible.
I’ll explain my half solution here and propose a possible hack that could make this work better and keep you from accidentally freezing your app when Mac OS X decides it is time to jump into Japanese entry mode without asking.
The solution is very simple: when you use find and replace window Japanese text is handled fine. So hitting cmd-f before entering Japanese text, then cmd-a to select all, cmd-c to copy, cmd-w to close the find window, and cmd-v to paste the text into the document you were on at the insertion point gets Japanese text into the document without problem. That may sound like a long list of keyboard shortcuts, but they are all natural, muscle-memory shortcuts for me and, I’d guess, for most power users. Still it remains a pain in the posterior, and since no other applications require a workflow like this I end up with a Japanese-text-frozen text mate about half the time. There has to be a better way!
A proposal for the other half
I can think of a number of things that could be done to automate the workflow described above, but let me describe the one that seems to me most likely to be achievable through the use of existing tools (It may even be poossiblw with bundles though it was beyond me to figure out in the brief time I looked into it):
I envision some type of environment monitor that can be set on a per-app basis that would allow the firing of actions before certain actions when in certain environments. This app would be configured as follows for text mate. When in TextMate in an Asian-character input mode and the active window a document, a character producing keystroke would open up the find and replace dialog before sending the keystroke through. When the active window is the find and replace dialog and in an Asian-character input mode, switching to an non-Asian-character input mode or hitting cmd-w would execute the following: cmd-a,cmd-c,cmd-w,cmd-v,switch input mode if that was what triggered the sequence.
This idea is a total kludge, but would certainly make my life easier. Like I say, there are a ton of other ways to do pretty much the same thing (a find and replace document wouldn’t even have to be the external editor). In addition you’d really want any selected text to be copied to the external editor, and a lot of other little niceties, but as it sounds like it will be quite a while until Allan even thinks about making TextMate handle Asian fonts, I need all the help I can get as soon as I can get it, so that I can quit jumping between editors.
Page 1 of 1 pages