Created
July 18, 2012 12:00
-
-
Save mattn/3135784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff -r 11d40fc82f11 src/getchar.c | |
| --- a/src/getchar.c Thu Jul 12 22:01:11 2012 +0200 | |
| +++ b/src/getchar.c Wed Jul 18 21:00:22 2012 +0900 | |
| @@ -1802,7 +1802,11 @@ | |
| do | |
| { | |
| c = safe_vgetc(); | |
| - } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); | |
| + } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR | |
| +#if defined(FEAT_GUI_GTK) | |
| + || preedit_get_status() | |
| +#endif | |
| + ); | |
| return c; | |
| } | |
| diff -r 11d40fc82f11 src/mbyte.c | |
| --- a/src/mbyte.c Thu Jul 12 22:01:11 2012 +0200 | |
| +++ b/src/mbyte.c Wed Jul 18 21:00:22 2012 +0900 | |
| @@ -4371,7 +4371,14 @@ | |
| if (State & CMDLINE) | |
| preedit_start_col = cmdline_getvcol_cursor(); | |
| else if (curwin != NULL) | |
| - getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL); | |
| + { | |
| + /* Check commit buf is remains. If not flushed, cursor should move of | |
| + * current character. */ | |
| + if (vim_is_input_buf_empty()) | |
| + getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL); | |
| + else | |
| + getvcol(curwin, &curwin->w_cursor, NULL, NULL, &preedit_start_col); | |
| + } | |
| /* Prevent that preediting marks the buffer as changed. */ | |
| xim_changed_while_preediting = curbuf->b_changed; | |
| } | |
| @@ -4388,13 +4395,8 @@ | |
| void | |
| im_set_active(int active) | |
| { | |
| - int was_active; | |
| - | |
| - was_active = !!im_is_active; | |
| - im_is_active = (active && !p_imdisable); | |
| - | |
| - if (im_is_active != was_active) | |
| - xim_reset(); | |
| + xim_reset(); | |
| + im_is_active = !p_imdisable; | |
| } | |
| void | |
| @@ -5014,59 +5016,11 @@ | |
| { | |
| if (xic != NULL) | |
| { | |
| - /* | |
| - * The third-party imhangul module (and maybe others too) ignores | |
| - * gtk_im_context_reset() or at least doesn't reset the active state. | |
| - * Thus sending imactivatekey would turn it off if it was on before, | |
| - * which is clearly not what we want. Fortunately we can work around | |
| - * that for imhangul by sending GDK_Escape, but I don't know if it | |
| - * works with all IM modules that support an activation key :/ | |
| - * | |
| - * An alternative approach would be to destroy the IM context and | |
| - * recreate it. But that means loading/unloading the IM module on | |
| - * every mode switch, which causes a quite noticeable delay even on | |
| - * my rather fast box... | |
| - * * | |
| - * Moreover, there are some XIM which cannot respond to | |
| - * im_synthesize_keypress(). we hope that they reset by | |
| - * xim_shutdown(). | |
| - */ | |
| - if (im_activatekey_keyval != GDK_VoidSymbol && im_is_active) | |
| - im_synthesize_keypress(GDK_Escape, 0U); | |
| - | |
| - gtk_im_context_reset(xic); | |
| - | |
| - /* | |
| - * HACK for Ami: This sequence of function calls makes Ami handle | |
| - * the IM reset graciously, without breaking loads of other stuff. | |
| - * It seems to force English mode as well, which is exactly what we | |
| - * want because it makes the Ami status display work reliably. | |
| - */ | |
| - gtk_im_context_set_use_preedit(xic, FALSE); | |
| - | |
| - if (p_imdisable) | |
| - im_shutdown(); | |
| - else | |
| + im_shutdown(); | |
| + if (!p_imdisable) | |
| { | |
| - gtk_im_context_set_use_preedit(xic, TRUE); | |
| + xim_init(); | |
| xim_set_focus(gui.in_focus); | |
| - | |
| - if (im_activatekey_keyval != GDK_VoidSymbol) | |
| - { | |
| - if (im_is_active) | |
| - { | |
| - g_signal_handler_block(xic, im_commit_handler_id); | |
| - im_synthesize_keypress(im_activatekey_keyval, | |
| - im_activatekey_state); | |
| - g_signal_handler_unblock(xic, im_commit_handler_id); | |
| - } | |
| - } | |
| - else | |
| - { | |
| - im_shutdown(); | |
| - xim_init(); | |
| - xim_set_focus(gui.in_focus); | |
| - } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment