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

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

Expand Messages
  • SungHyun Nam
    Jul 1 6:17 PM
    • 0 Attachment
      Bram Moolenaar wrote:
      > SungHyun Nam wrote:
      >
      >> I noticed the Cursor and CursorIM color is not displayed correctly in
      >> VIM 7.2a.
      >> VIM 7.1.xxx (Last xxx was 330) worked as expected.
      >>
      >> For the VIM 7.2a;
      >> 1. run gvim -> 'Cursor' color
      >> 2. type 'i' -> 'Cursor' color
      >> 3. type imak (s-space) -> 'CursorIM' color
      >> I can input Hangul..
      >> 4. type imak (s-space) again -> oops! 'CursorIM' color yet.. :-(
      >> But, I can input English..
      >> VIM 7.1 shows 'Cursor' color.
      >>
      >> Through 2 to 4 stage, command-line window(?) always shows '-- INSERT
      --'.
      >>
      >> And, now..
      >>
      >> 5. type ESC -> 'Cursor' color
      >> 6. type 'i' -> 'CursorIM' color, but I can input English.
      >> And now, command-line window shows '-- IM INSERT --'.
      >>
      >> Cursor color is important to distinguish current input language.
      >>
      >> I always build VIM from CVS and build options was not changed.
      >> And I tried to change the CFLAGS as:
      >> s/-Os -march=i686 -fomit-frame-pointer -fno-strict-aliasing
      -pthread/-O0/g
      >> The result was same. The cygwin is very recent version (I updated a few
      >> weeks ago).
      >
      > There is an "#if 0" in src/mbyte.c:
      >
      > #if 0
      > /* Removal of this line suggested by Takuhiro Nishioka. Fixes
      that IM was
      > * switched off unintentionally. */
      > im_is_active = FALSE;
      > #endif
      >
      > Perhaps this change is what matters?
      >
      > Looks like this is the usual mixup with using one flag for more than one
      > thing. Perhaps we also need a "preedit_is_active" flag?

      To me, the 'im_is_active' is never changed to FALSE after it is
      set. Then, why is this flag is needed? Well, it does not need
      for Korean, but need for Japanese?

      If the '#if 0' change is good, then you might want to apply a
      patch like below?
      (With this patch, now command-line window displays 'INSERT' and
      'IM INSERT' as I expected.)

      Regards,
      namsh

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

      - if (im_get_status())
      + if (preedit_get_status())
      {
      iid = syn_name2id((char_u *)"CursorIM");
      if (iid > 0)
      diff --git a/src/gui_mac.c b/src/gui_mac.c
      index 1ef5820..44f6511 100644
      --- a/src/gui_mac.c
      +++ b/src/gui_mac.c
      @@ -6501,6 +6501,12 @@ im_get_status(void)
      return im_is_active;
      }

      + int
      +preedit_get_status(void)
      +{
      + return im_get_status();
      +}
      +
      #endif /* defined(USE_IM_CONTROL) || defined(PROTO) */


      diff --git a/src/gui_w32.c b/src/gui_w32.c
      index 9b77f7d..0bc80c1 100644
      --- a/src/gui_w32.c
      +++ b/src/gui_w32.c
      @@ -2068,6 +2068,12 @@ im_get_status()
      return status;
      }

      + int
      +preedit_get_status()
      +{
      + return im_get_status();
      +}
      +
      #endif /* FEAT_MBYTE && FEAT_MBYTE_IME */

      #if defined(FEAT_MBYTE) && !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
      diff --git a/src/hangulin.c b/src/hangulin.c
      index 4ae16a1..02cb80b 100644
      --- a/src/hangulin.c
      +++ b/src/hangulin.c
      @@ -427,6 +427,12 @@ im_get_status()
      return hangul_input_state_get();
      }

      + int
      +preedit_get_status()
      +{
      + return im_get_status();
      +}
      +
      void
      hangul_input_state_toggle()
      {
      diff --git a/src/mbyte.c b/src/mbyte.c
      index d6edf20..2ad925f 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();
      }
      @@ -3971,6 +3975,7 @@ im_shutdown(void)
      xic = NULL;
      }
      im_is_active = FALSE;
      + preedit_is_active = FALSE;
      im_commit_handler_id = 0;
      preedit_start_col = MAXCOL;
      xim_has_preediting = FALSE;
      @@ -4283,6 +4288,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
      @@ -5721,6 +5732,12 @@ im_get_status()
      return xim_has_focus;
      }

      + int
      +preedit_get_status()
      +{
      + return im_get_status();
      +}
      +
      # endif /* !HAVE_GTK2 */

      # if defined(FEAT_GUI_GTK) || defined(PROTO)
      diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro
      index 3a47698..08386d3 100644
      --- a/src/proto/gui_w32.pro
      +++ b/src/proto/gui_w32.pro
      @@ -71,6 +71,7 @@ void im_set_font __ARGS((LOGFONT *lf));
      void im_set_position __ARGS((int row, int col));
      void im_set_active __ARGS((int active));
      int im_get_status __ARGS((void));
      +int preedit_get_status __ARGS((void));
      void gui_mch_draw_string __ARGS((int row, int col, char_u *text, int
      len, int flags));
      void gui_mch_flush __ARGS((void));
      void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h));
      diff --git a/src/proto/hangulin.pro b/src/proto/hangulin.pro
      index adfde14..31778a1 100644
      --- a/src/proto/hangulin.pro
      +++ b/src/proto/hangulin.pro
      @@ -2,6 +2,7 @@
      int hangul_input_state_get __ARGS((void));
      void hangul_input_state_set __ARGS((int state));
      int im_get_status __ARGS((void));
      +int preedit_get_status __ARGS((void));
      void hangul_input_state_toggle __ARGS((void));
      void hangul_keyboard_set __ARGS((void));
      int hangul_input_process __ARGS((char_u *s, int len));
      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..0640f4b 100644
      --- a/src/screen.c
      +++ b/src/screen.c
      @@ -8855,8 +8855,7 @@ 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 (xic != NULL && preedit_get_status() && !p_imdisable)
      # 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