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

51053Re: VIM 7.2a.10 (GTK2, cygwin) weird cursor color problem

Expand Messages
  • SungHyun Nam
    Jul 3, 2008
      Hello,

      First of all, your patch for mbyte.c is totally different for this
      thread. You could send it with different bug report.
      It seems your patch for mbyte.c is fine to me though I test it not
      much.

      Added comment below is only for CursorIM problem.

      mattn wrote:
      > On Thu, Jul 3, 2008 at 1:24 PM, SungHyun Nam <goweol@...> wrote:
      >> mattn wrote:
      >> >
      >> > Yes, my solution is the fixing of above. CursorIM is getting
      status of
      >> > IM from "im_get_status()".
      >> > But vim should set status of preediting for CursorIM. My roughly
      patch
      >> > is fixing this.
      >>
      >> I am somewhat confused. Did you check my patch I sent out?
      >> I read your mail that your patch is same as my patch.
      >> http://permalink.gmane.org/gmane.editors.vim.devel/20376
      >>
      >> Or could you include your patch? At least, people including me can
      >> verify it works fine for them.
      >
      > Ah, it's similar. sorry i didn't see your patch. X-(
      > And my patch include other fix.
      > vim should be disconnect handler of preediting signal.
      > Some IM which i tried was crash with typing <ESC>.

      Hmm, it's similar and very small, but has glitch(?).
      With your patch, 'CursorIM' color is NOT displayed immediately
      after typing 'imak'. Because actual preediting is not yet started.
      'CursorIM' color is displayed after I typed first multibyte
      character. So that, if I typed 'imak' (with no further input) and
      do something in other window, and come back, I can think current
      input mode is English.

      I suggest a patch below for the CursorIM problem:
      Side-note:
      The patch below also includes patch for command-line window
      message. 'INSERT' vs 'IM INSERT' message now synchronized to
      'Cursor' vs. 'CursorIM' color. I doubt 'b_p_iminsert' check
      is really needed in screen.c. I never typed 'Ctrl-^' so that
      b_p_iminsert is never have B_IMODE_IM for me.
      If it's not acceptable, I can remove it from the patch.

      Is this patch acceptable?

      Regards,

      diff --git a/src/gui.c b/src/gui.c
      index 09c3027..decb0fb 100644
      --- a/src/gui.c
      +++ b/src/gui.c
      @@ -958,7 +958,13 @@ gui_update_cursor(force, clear_selection)
      static int iid;
      guicolor_T fg, bg;

      - if (im_get_status())
      + if (
      +#ifdef HAVE_GTK2
      + preedit_get_status()
      +#else
      + im_get_status()
      +#endif
      + )
      {
      iid = syn_name2id((char_u *)"CursorIM");
      if (iid > 0)
      diff --git a/src/mbyte.c b/src/mbyte.c
      index d6edf20..59c2ff8 100644
      --- a/src/mbyte.c
      +++ b/src/mbyte.c
      @@ -3454,6 +3454,7 @@ init_preedit_start_col(void)
      # if defined(HAVE_GTK2) && !defined(PROTO)

      static int im_is_active = FALSE; /* IM is enabled for current
      mode */
      +static int preedit_is_active = FALSE;
      static int im_preedit_cursor = 0; /* cursor offset in characters
      */
      static int im_preedit_trailing = 0; /* number of characters after
      cursor */

      @@ -3686,7 +3687,9 @@ im_preedit_start_cb(GtkIMContext *context,
      gpointer data)
      #endif

      im_is_active = TRUE;
      + preedit_is_active = TRUE;
      gui_update_cursor(TRUE, FALSE);
      + im_show_info();
      }

      /*
      @@ -3710,6 +3713,7 @@ im_preedit_end_cb(GtkIMContext *context, gpointer
      data)
      * switched off unintentionally. */
      im_is_active = FALSE;
      #endif
      + preedit_is_active = FALSE;
      gui_update_cursor(TRUE, FALSE);
      im_show_info();
      }
      @@ -4283,6 +4287,12 @@ im_get_status(void)
      return im_is_active;
      }

      + int
      +preedit_get_status(void)
      +{
      + return preedit_is_active;
      +}
      +
      # else /* !HAVE_GTK2 */

      static int xim_is_active = FALSE; /* XIM should be active in the current
      diff --git a/src/proto/mbyte.pro b/src/proto/mbyte.pro
      index ef11dc7..cac9ba8 100644
      --- a/src/proto/mbyte.pro
      +++ b/src/proto/mbyte.pro
      @@ -82,6 +82,7 @@ void xim_init __ARGS((void));
      void im_shutdown __ARGS((void));
      int xim_get_status_area_height __ARGS((void));
      int im_get_status __ARGS((void));
      +int preedit_get_status __ARGS((void));
      int im_is_preediting __ARGS((void));
      int convert_setup __ARGS((vimconv_T *vcp, char_u *from, char_u *to));
      int convert_input __ARGS((char_u *ptr, int len, int maxlen));
      diff --git a/src/screen.c b/src/screen.c
      index 78dd277..ea15338 100644
      --- a/src/screen.c
      +++ b/src/screen.c
      @@ -8855,8 +8855,13 @@ showmode()
      {
      MSG_PUTS_ATTR("--", attr);
      #if defined(FEAT_XIM)
      - if (xic != NULL && im_get_status() && !p_imdisable
      - && curbuf->b_p_iminsert == B_IMODE_IM)
      + if (
      +#ifdef HAVE_GTK2
      + preedit_get_status()
      +#else
      + im_get_status()
      +#endif
      + )
      # ifdef HAVE_GTK2 /* most of the time, it's not XIM being used */
      MSG_PUTS_ATTR(" IM", attr);
      # else

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 18 messages in this topic