Windowsã®Sublime Text 2 ã§IMEã®ã¤ã³ã©ã¤ã³å¤æã§ããããã«ããã®ã§ã¾ã¨ã
ç¾å¨ã® Windowsç¨ã® Sublime Text 2 㯠IME ã®ã¤ã³ã©ã¤ã³å¤æã®å ¥åæåãã¦ã£ã³ãã¦ã®å¤ã¨ããããããªå ´æã«è¡¨ç¤ºããã¦ãã¾ãåé¡ãããã¾ããããããæ£ããã«ã¼ã½ã«ä½ç½®ã«è¡¨ç¤ºãããã©ã°ã¤ã³ãä½ãã¾ããã詳細㯠github ã«ç½®ãããªãã¸ããªã®READMEãè¦ã¦ãã ããã
GitHub - chikatoike/IMESupport: IMESupport for Sublime Text 2/3
ãã®ã¨ã³ããªã¼ã§ã¯ãå®è£ ã«ä½¿ã£ãæ段ãæ¸ãã¦ããã¾ãã
ã¤ã³ã©ã¤ã³å¤æã®å®è£ ã«å¿ è¦ã ã£ãã®ã¯ä»¥ä¸ã®3ç¹ã§ãã
- å¤æã¦ã£ã³ãã¦ã®ä½ç½®æå®
- å¤æéå§ã¤ãã³ãã®ãã³ããªã³ã°
- å¤æã¦ã£ã³ãã¦ã®ä½ç½®è¨ç®
å¤æã¦ã£ã³ãã¦ã®ä½ç½®æå®
ã¤ã³ã©ã¤ã³å¤æã®è¡¨ç¤ºä½ç½®ãããããã®ã¯ãSublime Text 2ã表示ä½ç½®ãæå®ãã¦ããªãããã§ãã ããã¯ãåã« Win32 APIã® ImmSetCompositionWindow ãå¼ã³åºãã°å¯¾å¿ã§ãã¾ããããã¦ãSublime Text 2ãæè¼ããPythonå¦çç³»ã¯ãå½ç¶ctypesãå梱ãã¦ããã®ã§ãWin32 APIãå¼ã³åºããã¨ãã§ãã¾ãã
ããã«æ°ã¥ããã®ã§ããã©ã°ã¤ã³ãä½ãå§ãã¾ããã
å¤æéå§ã¤ãã³ãã®ãã³ããªã³ã°
ImmSetCompositionWindow ãå¼ã³åºãã ããã¨è¨ã£ã¦ããIMEã®å¤æéå§æã«é©åãªã¿ã¤ãã³ã°ã§å¼ã³åºãå¿
è¦ãããã¾ãã å
·ä½çã«ã¯ãã¦ã£ã³ãã¦ã¡ãã»ã¼ã¸ã¨ã㦠WM_IME_STARTCOMPOSITION ã渡ã£ã¦ããæã«å¼ã³åºãã¾ãã
ã¦ã£ã³ãã¦ã¡ãã»ã¼ã¸ãå¦çããã«ã¯ãã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ãå®è£
ããå¿
è¦ãããã¾ãããæ®éã¯ãã¹ã¦ã®ã¡ãã»ã¼ã¸ã¯ Sublime Text 2 ãå¦çãã¦ãã¾ãã¾ããããããã©ã°ã¤ã³å´ã§å¦çã§ããããã«ããããã«ãã¦ã£ã³ãã¦ã®ãµãã¯ã©ã¹åã¨ããæ¹æ³ã使ãã¾ããã
ç¬èªã®ã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ãPythonã®é¢æ°ã¨ãã¦å®è£
ãã¦ããããCè¨èªã®é¢æ°ãã¤ã³ã¿ã¨ãã¦æ±ããããã«å¤æãã SetWindowLongW é¢æ°ã使ã£ã¦ã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ã®é¢æ°ãã¤ã³ã¿ãç½®ãæãã¾ããå
ã®ã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ã®ãã¤ã³ã¿ã¯ä¿åãã¦ããã¦ãIMEã«ç¡é¢ä¿ã®ã¡ãã»ã¼ã¸ã¯å
ã®ã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ã§å¦çããã¾ãã
å¤æã¦ã£ã³ãã¦ã®ä½ç½®è¨ç®
ãããä¸çªå¤§å¤ã§ãããã¦ã£ã³ãã¦ã®å·¦ä¸ããã«ã¼ã½ã«ä½ç½®ã¾ã§ã®è·é¢ã ImmSetCompositionWindow ã«æ¸¡ãå¿
è¦ãããã®ã§ãããSublime Text 2ã«ãããç´æ¥åå¾ããAPIã¯åå¨ããªãã®ã§ãããããè¨ç®ããå¿
è¦ãããã¾ããã
(ãã¨ã§è©³ããæ¸ã)
è£è¶³
Win32 APIã®å¹¾ã¤ãã¯ãã¦ã£ã³ãã¦ãã³ãã«(hwnd)ãå¼æ°ã¨ãã¦åãã¾ãããã㯠Sublime Text 2ã® Windowã¯ã©ã¹ã®hwndã¡ã½ãããå¼ã³åºãã¦åå¾ã§ãã¾ãããªãhwndã¯å ¬å¼ããã¥ã¡ã³ã(http://www.sublimetext.com/docs/2/api_reference.html#sublime.Window)ã«è¨è¼ããã¦ããªãã¡ã½ããã§ãã
ä»å¾ã®äºå®
- IMEã®ON/OFFãå¶å¾¡ã§ããã³ãã³ãã追å ããäºå®ã§ãããã ããªãã ImmSetOpenStatus ãå¼ã³åºã㨠"[Error 126] æå®ãããã¢ã¸ã¥ã¼ã«ãè¦ã¤ããã¾ããã" ã¨ããã¨ã©ã¼ãåºã¦ãã¾ã£ã¦å®ç¾ã§ãã¦ãã¾ããã
- http://d.hatena.ne.jp/topiyama/20070703/p1 ã«æ¸ãã¦ãããããªã IMEã®åå¾åç §å¤ææ©è½ ã«å¯¾å¿ããäºå®ã§ãã