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

Vim 6.0 - w32 and mbyte_ime - ime cursor color

Expand Messages
  • Taro Muraoka
    For Windows and multibyte (IME). This is a little feature. When IME is on (that means user can input multibyte text now), cursor color was changed. The
    Message 1 of 4 , Jul 24, 2000
    • 0 Attachment
      For Windows and multibyte (IME). This is a little feature. When IME is
      on (that means user can input multibyte text now), cursor color was
      changed. The color was specified by highlight group CursorIM. Example:

      if has('multi_byte_ime')
      highlight CursorIM guibg=Purple guifg=NONE
      endif

      Regards.
      ----
      Taro Muraoka <koron@...>


      Files: src/gui.c src/gui_w32.c

      *** src/gui_w32.c Mon Jul 24 02:08:30 2000
      --- src.j/gui_w32.c Mon Jul 24 06:06:56 2000
      ***************
      *** 228,233 ****
      --- 228,234 ----
      static int sysfixed_height = 0;
      # ifdef FEAT_MBYTE_IME
      static LOGFONT norm_logfont;
      + static LRESULT _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData);
      # endif
      # if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
      /* GIME_TEST */
      ***************
      *** 1913,1918 ****
      --- 1914,1925 ----
      break;
      #endif

      + #ifdef FEAT_MBYTE_IME
      + case WM_IME_NOTIFY:
      + if (!_OnImeNotify(hwnd, (DWORD)wParam, (DWORD)lParam))
      + return DefWindowProc(hwnd, uMsg, wParam, lParam);
      + #endif
      +
      default:
      if (uMsg == msh_msgmousewheel && msh_msgmousewheel != 0)
      { /* handle MSH_MOUSEWHEEL messages for Intellimouse */
      ***************
      *** 3235,3240 ****
      --- 3242,3299 ----
      }

      /*
      + * new function for WM_IME_NOTIFY message
      + */
      + static BOOL bImeStatus = FALSE;
      +
      + static LRESULT
      + _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData)
      + {
      + LRESULT lResult = 0;
      + HIMC hImc;
      +
      + if (!(hImc = ImmGetContext(hWnd)))
      + return lResult;
      + switch (dwCommand)
      + {
      + case IMN_SETOPENSTATUS:
      + if (bImeStatus = ImmGetOpenStatus(hImc))
      + {
      + ImmSetCompositionFont(hImc, &norm_logfont);
      + ImePositionWindow(hImc);
      + }
      + gui_update_cursor(TRUE, FALSE);
      + lResult = 1;
      + break;
      + }
      + ImmReleaseContext(hWnd, hImc);
      + return lResult;
      + }
      +
      + /*
      + * When status IME is 'open' change cursor color to hilight 'CursorIM'
      + */
      + guicolor_t
      + ImeGetCursorColor(guicolor_t color)
      + {
      + static int id = 0;
      + guicolor_t fg, bg;
      +
      + if (bImeStatus)
      + {
      + if (!id)
      + id = syn_name2id("CursorIM");
      + if (id)
      + {
      + syn_id2colors(id, &fg, &bg);
      + if (bg)
      + color = bg - 1;
      + }
      + }
      + return color;
      + }
      +
      + /*
      * Get context and position IME composition window.
      */
      void
      ***************
      *** 3424,3429 ****
      --- 3483,3489 ----
      return NULL;
      }

      + #if 0
      static void
      ImeNotify(WPARAM w, LPARAM l)
      {
      ***************
      *** 3447,3452 ****
      --- 3507,3513 ----
      ImmReleaseContext(s_hwnd, hImc);
      }
      }
      + #endif

      # if 0 // This is not used !?
      void
      ***************
      *** 4020,4025 ****
      --- 4081,4092 ----
      string[0] = Ctrl_HAT;
      add_to_input_buf(string, 1);
      }
      + /* Japanese keyboard map '^' to vk == 0xDE */
      + else if (MapVirtualKey(vk, 2) == (UINT)'^')
      + {
      + string[0] = Ctrl_HAT;
      + add_to_input_buf(string, 1);
      + }
      else
      TranslateMessage(&msg);
      }
      ***************
      *** 4039,4045 ****
      ImeUIEndComposition(s_hwnd);
      # endif
      else if (msg.message == WM_IME_NOTIFY)
      ! ImeNotify(msg.wParam, msg.lParam);
      #endif
      #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
      /* GIME_TEST */
      --- 4106,4112 ----
      ImeUIEndComposition(s_hwnd);
      # endif
      else if (msg.message == WM_IME_NOTIFY)
      ! _OnImeNotify(msg.hwnd, (DWORD)msg.wParam, (DWORD)msg.lParam);
      #endif
      #if !defined(FEAT_MBYTE_IME) && defined(GLOBAL_IME)
      /* GIME_TEST */
      *** src/gui.c Mon Jul 24 02:42:40 2000
      --- src.j/gui.c Mon Jul 24 06:06:56 2000
      ***************
      *** 656,664 ****
      --- 656,671 ----
      shape_table[idx].blinkoff);
      if (id > 0)
      {
      + #if defined(FEAT_GUI_W32) && defined(FEAT_MBYTE_IME)
      + guicolor_t ImeGetCursorColor(guicolor_t color);
      + #endif
      +
      cattr = syn_id2colors(id, &cfg, &cbg);
      --cbg;
      --cfg;
      + #if defined(FEAT_GUI_W32) && defined(FEAT_MBYTE_IME)
      + cbg = ImeGetCursorColor(cbg);
      + #endif
      }

      /*
    • Bram Moolenaar
      Taro Muraoka - ... Looks good. Can you write some documentation for this? -- It s totally unfair to suggest - as many have - that engineers are socially
      Message 2 of 4 , Jul 25, 2000
      • 0 Attachment
        Taro Muraoka -

        > For Windows and multibyte (IME). This is a little feature. When IME is
        > on (that means user can input multibyte text now), cursor color was
        > changed. The color was specified by highlight group CursorIM. Example:
        >
        > if has('multi_byte_ime')
        > highlight CursorIM guibg=Purple guifg=NONE
        > endif

        Looks good. Can you write some documentation for this?

        --
        It's totally unfair to suggest - as many have - that engineers are socially
        inept. Engineers simply have different objectives when it comes to social
        interaction.
        (Scott Adams - The Dilbert principle)

        /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
        \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
      • Taro Muraoka
        ... Yes. I had tried. It include some Global IME documentation. ... Taro Muraoka koron@tka.att.ne.jp
        Message 3 of 4 , Jul 25, 2000
        • 0 Attachment
          > > if has('multi_byte_ime')
          > > highlight CursorIM guibg=Purple guifg=NONE
          > > endif
          >
          > Looks good. Can you write some documentation for this?

          Yes. I had tried. It include some Global IME documentation.
          ----
          Taro Muraoka koron@...
        • Bram Moolenaar
          ... Thanks, I ll include this. I ll make the example use the new
          Message 4 of 4 , Jul 25, 2000
          • 0 Attachment
            Taro Muraoka wrote:

            > > > if has('multi_byte_ime')
            > > > highlight CursorIM guibg=Purple guifg=NONE
            > > > endif
            > >
            > > Looks good. Can you write some documentation for this?
            >
            > Yes. I had tried. It include some Global IME documentation.

            Thanks, I'll include this. I'll make the example use the new "><" syntax.
            And add an entry |hl-CursorIM| below |hl-Cursor|.

            --
            hundred-and-one symptoms of being an internet addict:
            1. You actually wore a blue ribbon to protest the Communications Decency Act.

            /// Bram Moolenaar Bram@... http://www.moolenaar.net \\\
            \\\ Vim: http://www.vim.org ICCF Holland: http://iccf-holland.org ///
          Your message has been successfully submitted and would be delivered to recipients shortly.