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

[vim-multibyte] Fix of Multibyte Message

Expand Messages
  • Yasuhiro Matsumoto
    Hi . Bram , vim-multibyte At operating file name in message line ... If it have multibyte character, then shown strange file name. I made patch for multibyte
    Message 1 of 1 , Feb 7, 2000
    • 0 Attachment
      Hi . Bram , vim-multibyte

      At operating file name in message line ...
      If it have multibyte character, then shown strange file name.

      I made patch for multibyte message.


      To Bram...
      I can't write english well,
      Please change my wrong words. ;-)

      ----------------------------------------------------------------------------
      Problem: Multibyte message don't show really.
      Solution: Skipping multibyte in function 'vim_strsave_escaped'.
      Divergging part of multibyte and singlebyte in function 'msg_puts_attr'.
      Skipping multibyte in functino 'screen_puts'.
      Files: src/misc2.c, src/message.c, src/screen.c

      *** src.orig/misc2.c Mon Jan 17 01:42:06 2000
      --- src/misc2.c Mon Feb 07 19:16:12 2000
      ***************
      *** 673,678 ****
      --- 673,686 ----
      length = 1; /* count the trailing '/' and NUL */
      for (p = string; *p; p++)
      {
      + #ifdef MULTI_BYTE
      + if(is_dbcs && IsLeadByte(*p) && *(p+1))
      + {
      + length += 2;
      + ++p; /* skip multibyte */
      + continue;
      + }
      + #endif /* MULTI_BYTE */
      if (vim_strchr(esc_chars, *p) != NULL)
      ++length; /* count a backslash */
      ++length; /* count an ordinary char */
      ***************
      *** 683,688 ****
      --- 691,704 ----
      p2 = escaped_string;
      for (p = string; *p; p++)
      {
      + #ifdef MULTI_BYTE
      + if(is_dbcs && IsLeadByte(*p) && *(p+1))
      + {
      + *p2++ = *p++; /* skip multibyte lead */
      + *p2++ = *p; /* skip multibyte trail */
      + continue;
      + }
      + #endif /* MULTI_BYTE */
      if (vim_strchr(esc_chars, *p) != NULL)
      *p2++ = '\\';
      *p2++ = *p;
      *** src.orig/message.c Mon Jan 17 01:42:04 2000
      --- src/message.c Mon Feb 07 19:17:52 2000
      ***************
      *** 24,29 ****
      --- 24,32 ----
      static void msg_home_replace_attr __ARGS((char_u *fname, int attr));
      static int msg_use_printf __ARGS((void));
      static void msg_screen_putchar __ARGS((int c, int attr));
      + #ifdef MULTI_BYTE
      + static void msg_screen_putcharw __ARGS((char_u *s, int attr));
      + #endif /* MULTI_BYTE */
      static int msg_check_screen __ARGS((void));
      static void redir_write __ARGS((char_u *s));
      #ifdef CON_DIALOG
      ***************
      *** 857,862 ****
      --- 860,880 ----

      while (--len >= 0)
      {
      + #ifdef MULTI_BYTE
      + if(is_dbcs && IsLeadByte(*str) && *(str+1))
      + {
      + /* check multibyte */
      + char_u buf[3];
      + buf[0] = *str++;
      + buf[1] = *str;
      + buf[2] = NUL;
      + msg_puts_attr(buf, attr);
      + len--;
      + retval += 2;
      + ++str;
      + continue;
      + }
      + #endif /* MULTI_BYTE */
      msg_puts_attr(transchar(*str), attr);
      retval += charsize(*str);
      ++str;
      ***************
      *** 1373,1378 ****
      --- 1391,1403 ----
      msg_screen_putchar(' ', attr);
      while (msg_col & 7);
      }
      + #ifdef MULTI_BYTE
      + else if(is_dbcs && IsLeadByte(*s) && *(s+1))
      + {
      + msg_screen_putcharw(s, attr);
      + ++s;
      + }
      + #endif /* MULTI_BYTE */
      else
      msg_screen_putchar(*s, attr);
      ++s;
      ***************
      *** 1412,1417 ****
      --- 1437,1463 ----
      ++msg_row;
      }
      }
      +
      + #ifdef MULTI_BYTE
      + static void
      + msg_screen_putcharw(s, attr)
      + char_u *s;
      + int attr;
      + {
      + char_u mbuff[3];
      + mbuff[0] = *s;
      + mbuff[1] = *(s+1);
      + mbuff[2] = NUL;
      + msg_didout = TRUE; /* remember that line is not empty */
      + screen_puts(s, msg_row, msg_col, attr);
      + msg_col += strlen(mbuff);
      + if (msg_col >= Columns)
      + {
      + msg_col = 0;
      + ++msg_row;
      + }
      + }
      + #endif /* MULTI_BYTE */

      void
      msg_moremsg(full)
      *** src.orig/screen.c Mon Feb 07 19:31:29 2000
      --- src/screen.c Mon Feb 07 19:18:46 2000
      ***************
      *** 3162,3167 ****
      --- 3162,3191 ----
      screenp = LinePointers[row] + col;
      while (*text && col < Columns)
      {
      + #ifdef MULTI_BYTE
      + char_u is_mbyte = FALSE;
      + if (is_dbcs && IsLeadByte(*text) && *(text+1))
      + {
      + /* check if multibyte need refresh */
      + if (*screenp != *text || *(screenp+1) != *(text+1)) is_mbyte = TRUE;
      + }
      + if (*screenp != *text || *(screenp + Columns) != attr ||
      + exmode_active || is_mbyte)
      + {
      + *screenp = *text;
      + *(screenp + Columns) = attr;
      + screen_char(screenp, row, col);
      + if (is_mbyte) /* refresh multibyte */
      + {
      + ++screenp;
      + ++col;
      + ++text;
      + *screenp = *text;
      + *(screenp + Columns) = attr;
      + screen_char(screenp, row, col);
      + }
      + }
      + #else
      if (*screenp != *text || *(screenp + Columns) != attr ||
      exmode_active)
      {
      ***************
      *** 3169,3174 ****
      --- 3193,3199 ----
      *(screenp + Columns) = attr;
      screen_char(screenp, row, col);
      }
      + #endif /* MULTI_BYTE */
      ++screenp;
      ++col;
      ++text;
    Your message has been successfully submitted and would be delivered to recipients shortly.