To: vim-dev@vim.org Subject: Patch 6.2f.028 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2f.028 Problem: GTK: When 'imactivatekey' is empty and XIM is inactive it can't be made active again. Cursor isn't updated immediately when changing XIM activation. Japanese XIM may hang when using 'imactivatekey'. Can't activate XIM after typing fFtT command or ":sh". Solution: Properly set the flag that indicates the IM is active. Update the cursor right away. Do not send a key-release event. Handle Normal mode and running an external command differently. (Yasuhiro Matsumoto) Files: src/mbyte.c *** ../vim-6.2f.027/src/mbyte.c Thu May 29 23:05:29 2003 --- src/mbyte.c Fri May 30 12:06:00 2003 *************** *** 3074,3079 **** --- 3074,3081 ---- char_u bskey[] = {CSI, 'k', 'b'}; char_u delkey[] = {CSI, 'k', 'D'}; + if (State & NORMAL) + return; for (; im_preedit_cursor > 0; --im_preedit_cursor) add_to_input_buf(bskey, (int)sizeof(bskey)); *************** *** 3086,3091 **** --- 3088,3095 ---- { char_u backkey[] = {CSI, 'k', 'l'}; + if (State & NORMAL) + return; # ifdef FEAT_RIGHTLEFT if ((State & CMDLINE) == 0 && curwin != NULL && curwin->w_p_rl) backkey[2] = 'r'; *************** *** 3123,3128 **** --- 3127,3133 ---- im_preedit_start_cb(GtkIMContext *context, gpointer data) { im_is_active = TRUE; + gui_update_cursor(TRUE, FALSE); } /* * Callback invoked after end to the preedit. *************** *** 3132,3137 **** --- 3137,3143 ---- im_preedit_end_cb(GtkIMContext *context, gpointer data) { im_is_active = FALSE; + gui_update_cursor(TRUE, FALSE); } /* *************** *** 3458,3468 **** --- 3464,3477 ---- event->keyval = keyval; event->hardware_keycode = /* needed for XIM */ XKeysymToKeycode(GDK_WINDOW_XDISPLAY(event->window), (KeySym)keyval); + event->length = 0; + event->string = NULL; gtk_im_context_filter_keypress(xic, event); /* For consistency, also send the corresponding release event. */ event->type = GDK_KEY_RELEASE; + event->send_event = FALSE; gtk_im_context_filter_keypress(xic, event); # ifdef HAVE_GTK_MULTIHEAD *************** *** 3528,3534 **** int xim_queue_key_press_event(GdkEventKey *event) { ! if (xic != NULL && !p_imdisable && (State & (INSERT | CMDLINE)) != 0) { /* * Filter 'imactivatekey' and map it to CTRL-^. This way, Vim is --- 3537,3544 ---- int xim_queue_key_press_event(GdkEventKey *event) { ! if (xic != NULL && !p_imdisable ! && (State & (INSERT | CMDLINE | NORMAL | EXTERNCMD)) != 0) { /* * Filter 'imactivatekey' and map it to CTRL-^. This way, Vim is *************** *** 3835,3841 **** NULL); XSetICValues(pxic, XNPreeditAttributes, preedit_attr, NULL); xim_preediting = active; ! xim_is_active = TRUE; } XFree(preedit_attr); } --- 3845,3851 ---- NULL); XSetICValues(pxic, XNPreeditAttributes, preedit_attr, NULL); xim_preediting = active; ! xim_is_active = active; } XFree(preedit_attr); } *** ../vim-6.2f.027/src/version.c Fri May 30 11:52:04 2003 --- src/version.c Fri May 30 12:09:51 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 28, /**/ -- How To Keep A Healthy Level Of Insanity: 14. Put mosquito netting around your work area. Play a tape of jungle sounds all day. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///