Loading ...
Sorry, an error occurred while loading the content.

Re: vim-GTK2 problem

Expand Messages
  • Daniel Elstner
    ... OK, I investigated this, and I m quite sure this is a problem of Ami itself. The GtkEntry code tries to get around it by avoiding IM resets whenever
    Message 1 of 3 , Mar 1, 2003
    • 0 Attachment
      On Fre, 2003-02-28 at 03:46, Nam SungHyun wrote:

      > > > I saw similar warning with gtkentry. And the problem was fixed.
      > > > from the gtk+/ChangeLog.pre-2-2. I believe next entry is it.
      > > >
      > > > Mon Dec 16 21:39:28 2002 Owen Taylor <otaylor@...>
      > > >
      > > > * gtk/gtkentry.c (gtk_entry_enter_text): Call
      > > > gtk_entry_set_position_internal() that takes a
      > > > new "reset_IM" parameter, so that we avoid the
      > > > problem where committing text would reset the
      > > > input method. (#74381, Kang Jeong-Hee)
      > >
      > > Hmm, I had a look at the GtkEntry code and couldn't find anything
      > > obviously related to the warning above. If it is indeed a problem in
      > > Vim and not the IM module I'll need to know more details to fix it.
      >
      > Check the GNOME bugzila #74381 (http://bugzilla.gnome.org).
      > I think you can get a useful information from there.

      OK, I investigated this, and I'm quite sure this is a problem of Ami
      itself. The GtkEntry code tries to get around it by avoiding IM resets
      whenever possible, but that's apparently not sufficient: try using the
      mouse to change the cursor position while preediting -- you'll get the
      same warning again.

      Nonetheless I tried to apply the same strategy of avoiding resets to the
      Vim code but that just broke lots of other things all over the place.
      However, in the end I found a kludge that seems to work:

      gtk_im_context_set_use_preedit(xic, FALSE);
      gtk_im_context_set_use_preedit(xic, TRUE);
      xim_set_focus(gui.in_focus);

      These silly 3 lines seem to make Ami handle the gtk_im_context_reset()
      gratiously. It seems to work even better than the GtkEntry work-around,
      plus it makes the Ami status window display the current language mode
      correctly. I'm still able to trigger the warning spuriously (and even
      make Ami hang) in a UTF-8 locale but that's probably another bug in
      Ami. LANG=ko_KR.eucKR works fine so far.

      As usual, here's the patch:

      http://regexxer.sourceforge.net/vim/vim-gtk2-20030302.patch.gz

      Another fixed problem: There seems to be a bug in the documentation of
      gtk_im_context_get_preedit_string(). It claims cursor_pos is a byte
      offset but in fact it's in characters (or code points). The GtkEntry
      code also interpretes cursor_pos as character index, and doing so in Vim
      fixed the mispositioned cursor when using Ami.

      BTW I had a look at the Ami sources but I refuse to work on code that's
      commented in Korean language :P

      Regards,
      --Daniel
    Your message has been successfully submitted and would be delivered to recipients shortly.