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

[vim-multibyte] Re: Special multibyte in menu is not displayed correctly

Expand Messages
  • Bram Moolenaar
    ... I suspect this can cause problems when using 8-bit characters in a menu. I think it s better to use is_dbcs here, even though that s actually for buffer
    Message 1 of 5 , Jan 15, 2000
      Taro Muraoka wrote:

      > -Special multibyte character cannot be used in menu. (1K)
      > Please test.
      > ----
      > Taro Muraoka <koron@...>
      >
      >
      > Problem: Menu item have multibyte character '\' trail, cannot be displayed
      > correctly.
      > Solution: Add codes consider multibyte. Foward pointer 2 byte if pointed
      > character is lead byte of multibyte.
      > Files: src/menu.c
      >
      >
      > *** ./src.orig/menu.c Sun Dec 05 03:56:08 1999
      > --- ./src/menu.c Sat Jan 15 14:43:08 2000
      > ***************
      > *** 1016,1021 ****
      > --- 1016,1028 ----
      > if (*p == NUL)
      > break;
      > }
      > + #ifdef MULTI_BYTE
      > + else if (IsLeadByte(*p)) /* skip multibyte */
      > + {
      > + ++p;
      > + continue;
      > + }
      > + #endif
      > if (*p)
      > *p++ = NUL;
      > return p;

      I suspect this can cause problems when using 8-bit characters in a menu. I
      think it's better to use is_dbcs here, even though that's actually for buffer
      text. How about this patch instead:

      *** ../vim-5.6a.28/src/menu.c Mon Dec 20 09:59:12 1999
      --- src/menu.c Sat Jan 15 21:24:15 2000
      ***************
      *** 1010,1021 ****
      --- 1010,1027 ----
      char_u *p;

      for (p = name; *p && *p != '.'; p++)
      + {
      if (*p == '\\' || *p == Ctrl('V'))
      {
      mch_memmove(p, p + 1, STRLEN(p));
      if (*p == NUL)
      break;
      }
      + #ifdef MULTI_BYTE
      + else if (is_dbcs && IsLeadByte(*p) && p[1] != NUL)
      + ++p; /* skip multibyte char */
      + #endif
      + }
      if (*p)
      *p++ = NUL;
      return p;

      --
      hundred-and-one symptoms of being an internet addict:
      188. You purchase a laptop so you can surf while sitting on the can.

      --/-/---- Bram Moolenaar ---- Bram@... ---- Bram@... ---\-\--
      \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /
    • Taro Muraoka
      ... Yes, indeed to use is_dbcs is better way. But there is one very very small problem and question. If multibyte menu user did not set fileencoding before
      Message 2 of 5 , Jan 15, 2000
        Bram Moolenaar wrote:
        > I suspect this can cause problems when using 8-bit characters in a menu. I
        > think it's better to use is_dbcs here, even though that's actually for buffer
        > text. How about this patch instead:
        >
        > *** ../vim-5.6a.28/src/menu.c Mon Dec 20 09:59:12 1999
        > --- src/menu.c Sat Jan 15 21:24:15 2000
        > ***************
        > *** 1010,1021 ****
        > --- 1010,1027 ----
        > char_u *p;
        >
        > for (p = name; *p && *p != '.'; p++)
        > + {
        > if (*p == '\\' || *p == Ctrl('V'))
        > {
        > mch_memmove(p, p + 1, STRLEN(p));
        > if (*p == NUL)
        > break;
        > }
        > + #ifdef MULTI_BYTE
        > + else if (is_dbcs && IsLeadByte(*p) && p[1] != NUL)
        > + ++p; /* skip multibyte char */
        > + #endif
        > + }
        > if (*p)
        > *p++ = NUL;
        > return p;


        Yes, indeed to use is_dbcs is better way. But there is one very very small
        problem and question. If multibyte menu user did not set 'fileencoding' before
        menu.vim was loaded, buffer would be initialized wrong. In this case user lose
        all chances to correct this. Menu is not updated, even if user type ":set
        fe=japan" in vim session.

        Of cource it is one easy solution that distribute multibyte menu.vim with a
        comment "WARNING: Do not forget to set 'fileencoding' option in your _vimrc.
        Just add line 'set fe=japan' in your _vimrc". Anoter way, at top of multibyte
        menu.vim distribute, add "set fe=japan". Or is there any good way to reload
        menu buffer?

        Post script...
        Screen shot of gVim with Japanese menu is available here.
        http://ixeris.bios.ics.saitama-u.ac.jp/~koron/software/img/gvim-5.6a.21-00.gif
        ----
        Taro Muraoka koron@...


        ----
        Taro Muraoka mailto:koron@...
      • Sven Guckes
        ... Now available on the Vim Picture Page: page: http://www.math.fu-berlin.de/~guckes/vim/pics.html#muraoka page: http://www.vim.org/pics.html#muraoka link:
        Message 3 of 5 , Jan 17, 2000
          * Taro Muraoka <koron@...> [000116 07:24]:
          > Screen shot of gVim with Japanese menu is available here.
          > http://ixeris.bios.ics.saitama-u.ac.jp/~koron/software/img/gvim-5.6a.21-00.gif

          Now available on the Vim Picture Page:
          page: http://www.math.fu-berlin.de/~guckes/vim/pics.html#muraoka
          page: http://www.vim.org/pics.html#muraoka
          link: http://www.vim.org/pics/muraoka.gvim-5.6a-jp.gif

          Is this ok with you, Muraoka-san?

          Sven

          --
          Sven Guckes@... VIM Picture Gallery
          VIM PICS Buttons and Logos: http://www.vim.org/pics.html#icons
          VIM PICS Screenshots: http://www.vim.org/pics.html#screenshots
          VIM PICS Got a cool picture of your editing enviornment to share? Send it!
        • Taro Muraoka
          ... Yes of cource. ... Taro Muraoka koron@tka.att.ne.jp
          Message 4 of 5 , Jan 17, 2000
            > Now available on the Vim Picture Page:
            > page: http://www.math.fu-berlin.de/~guckes/vim/pics.html#muraoka
            > page: http://www.vim.org/pics.html#muraoka
            > link: http://www.vim.org/pics/muraoka.gvim-5.6a-jp.gif
            >
            > Is this ok with you, Muraoka-san?

            Yes of cource.
            ----
            Taro Muraoka koron@...
          Your message has been successfully submitted and would be delivered to recipients shortly.