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

391Re: XIM input status in vim6.0 [test patch]

Expand Messages
  • Steven Mueller
    Apr 20 3:57 AM
    • 0 Attachment
      I decided to look into setting up a vim variable v:preediting
      (probably not the best of names...). Getting this working wasn't
      difficult, but I can't seem to get the status line to refresh when
      preedit mode is activated or deactivated. I've tried various
      functions, but this is the first time I've actually done anything with
      the Vim code so I don't really know what I'm doing. My .vimrc
      includes something to the tune of:

      function! FlagPreed()
      if v:preediting
      return "[¤¢]"
      else
      return ''
      endif
      endfunction

      if exists("v:preediting")
      set stl=%{FlagPreed()}%3n[%Y]%f\ %([%R%H%W]%)%=\ %2*%{Ifelse(&columns>100,strftime('%a\ %m/%d\ %T'),strftime('%a%m%d\ %H%M%S'))}%*%7(#%o:%)%2B[%03b]%4l/%L.%2c-%-3(%v%)%4P
      endif

      As you can see from the patch below, I've put the functionality in
      into the previously empty preedit callbacks. I'm not sure if this is
      the right way to do it, but it was the easiest for me to find and
      seems to suit my purpose. When the msg() calls are uncommented, those
      messages are printed at the time that I hit shift-space to enter into
      or exit from preediting mode. However, the status line does not
      update until I type something.

      Bram: how does this patch look to you? If you could point me in the
      right direction for getting the status line to refresh properly, I'd
      be greatly appreciative. I'm also open to suggestions on the name of
      the added v:variable. I don't know if I'll be able to get very far on
      any of the other suggestions I made, but I'll look into the cursor
      change possibility.

      Steve

      --- vim60ab/src/eval.c Mon Apr 16 10:52:11 2001
      +++ vim60ab-work/src/eval.c Thu Apr 19 21:48:37 2001
      @@ -170,6 +170,7 @@
      {"foldstart", sizeof("foldstart") - 1, NULL, VAR_NUMBER, VV_RO},
      {"foldend", sizeof("foldend") - 1, NULL, VAR_NUMBER, VV_RO},
      {"folddashes", sizeof("folddashes") - 1, NULL, VAR_STRING, VV_RO},
      + {"preediting", sizeof("preediting") -1, NULL, VAR_NUMBER, VV_RO},
      };

      static int eval0 __ARGS((char_u *arg, VAR retvar, char_u **nextcmd, int evaluate));
      --- vim60ab/src/mbyte.c Mon Apr 16 05:23:56 2001
      +++ vim60ab-work/src/mbyte.c Thu Apr 19 23:22:47 2001
      @@ -2925,6 +2925,13 @@
      static void
      preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      {
      + //msg("preedit_start_cbproc");
      + set_vim_var_nr(VV_PREEDITING, 1);
      +#ifdef FEAT_WINDOWS
      + status_redraw_all();
      + redraw_statuslines();
      + redraw_later(VALID);
      +#endif
      }

      static void
      @@ -3037,12 +3044,20 @@
      static void
      preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      {
      + msg("preedit_caret_cbproc");
      }

      /*ARGSUSED*/
      static void
      preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
      {
      + //msg("preedit_done_cbproc");
      + set_vim_var_nr(VV_PREEDITING, 0);
      +#ifdef FEAT_WINDOWS
      + status_redraw_all();
      + redraw_statuslines();
      + redraw_later(VALID);
      +#endif
      }

      void
      @@ -3194,6 +3209,7 @@
      == (int)GDK_IM_STATUS_CALLBACKS)
      {
      /* FIXME */
      + printf("in FIXME land\n");
      }
      #endif

      --- vim60ab/src/vim.h Sat Apr 14 13:20:35 2001
      +++ vim60ab-work/src/vim.h Thu Apr 19 21:48:52 2001
      @@ -1275,7 +1275,8 @@
      #define VV_FOLDSTART 21
      #define VV_FOLDEND 22
      #define VV_FOLDDASHES 23
      -#define VV_LEN 24 /* number of v: vars */
      +#define VV_PREEDITING 24
      +#define VV_LEN 25 /* number of v: vars */

      #ifdef FEAT_CLIPBOARD


      --
      Steven Mueller
      diffusor@...
    • Show all 6 messages in this topic