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

Patch 5.6.087

Expand Messages
  • Bram Moolenaar
    Patch 5.6.087 Problem: Multi-byte: Commands and messages with multi-byte characters are displayed wrong. Solution: Detect double-byte characters.
    Message 1 of 1 , Jun 5, 2000
    • 0 Attachment
      Patch 5.6.087
      Problem: Multi-byte: Commands and messages with multi-byte characters are
      displayed wrong.
      Solution: Detect double-byte characters. (Yasuhiro Matsumoto)
      Files: src/ex_getln.c, src/message.c, src/misc2.c, src/screen.c


      *** ../vim-5.6.86/src/ex_getln.c Mon Apr 3 21:11:13 2000
      --- src/ex_getln.c Mon Jun 5 12:35:31 2000
      ***************
      *** 1352,1357 ****
      --- 1352,1363 ----
      else
      #endif
      c = charsize(ccline.cmdbuff[i]);
      + #ifdef MULTI_BYTE
      + /* multibyte wrap */
      + if (is_dbcs && IsLeadByte(ccline.cmdbuff[i])
      + && (ccline.cmdspos % Columns + c == Columns))
      + ccline.cmdspos++;
      + #endif
      /* If the cmdline doesn't fit, put cursor on last visible char. */
      if ((ccline.cmdspos += c) >= m)
      {
      ***************
      *** 1687,1692 ****
      --- 1693,1699 ----
      int retval;
      int i;
      int m;
      + int c;

      if (len < 0)
      len = STRLEN(str);
      ***************
      *** 1735,1753 ****
      m = Columns * Rows;
      else
      m = MAXCOL;
      ! while (len--)
      {
      #ifdef CRYPTV
      if (cmdline_crypt)
      ! i = 1;
      else
      #endif
      ! i = charsize(str[len]);
      /* Stop cursor at the end of the screen */
      ! if (ccline.cmdspos + i >= m)
      break;
      ++ccline.cmdpos;
      ! ccline.cmdspos += i;
      }
      }
      }
      --- 1742,1766 ----
      m = Columns * Rows;
      else
      m = MAXCOL;
      ! for (i = 0; i < len; ++i)
      {
      #ifdef CRYPTV
      if (cmdline_crypt)
      ! c = 1;
      else
      #endif
      ! c = charsize(str[i]);
      ! #ifdef MULTI_BYTE
      ! /* multibyte wrap */
      ! if (is_dbcs && IsLeadByte(str[i])
      ! && ccline.cmdspos % Columns + c == Columns)
      ! ccline.cmdspos++;
      ! #endif
      /* Stop cursor at the end of the screen */
      ! if (ccline.cmdspos + c >= m)
      break;
      ++ccline.cmdpos;
      ! ccline.cmdspos += c;
      }
      }
      }
      *** ../vim-5.6.86/src/message.c Mon Dec 6 17:58:35 1999
      --- src/message.c Mon Jun 5 12:40:41 2000
      ***************
      *** 857,862 ****
      --- 857,877 ----

      while (--len >= 0)
      {
      + #ifdef MULTI_BYTE
      + /* check multibyte */
      + if (is_dbcs && *(str + 1) != NUL && IsLeadByte(*str))
      + {
      + char_u buf[3];
      +
      + buf[0] = *str++;
      + buf[1] = *str++;
      + buf[2] = NUL;
      + msg_puts_attr(buf, attr);
      + retval += 2;
      + --len;
      + continue;
      + }
      + #endif
      msg_puts_attr(transchar(*str), attr);
      retval += charsize(*str);
      ++str;
      ***************
      *** 1229,1236 ****
      * (some terminals scroll automatically, some don't. To avoid
      * problems we scroll ourselves)
      */
      ! if (msg_row >= Rows - 1 && (*s == '\n' || msg_col >= Columns - 1 ||
      ! (*s == TAB && msg_col >= ((Columns - 1) & ~7))))
      {
      /* When no more prompt an no more room, truncate here */
      if (msg_no_more && lines_left == 0)
      --- 1244,1257 ----
      * (some terminals scroll automatically, some don't. To avoid
      * problems we scroll ourselves)
      */
      ! if (msg_row >= Rows - 1
      ! && (*s == '\n'
      ! || msg_col >= Columns - 1
      ! || (*s == TAB && msg_col >= ((Columns - 1) & ~7))
      ! #ifdef MULTI_BYTE
      ! || (is_dbcs && IsLeadByte(*s) && msg_col >= Columns - 2)
      ! #endif
      ! ))
      {
      /* When no more prompt an no more room, truncate here */
      if (msg_no_more && lines_left == 0)
      ***************
      *** 1373,1378 ****
      --- 1394,1424 ----
      msg_screen_putchar(' ', attr);
      while (msg_col & 7);
      }
      + #ifdef MULTI_BYTE
      + else if (is_dbcs && *(s + 1) != NUL && IsLeadByte(*s))
      + {
      + if (msg_col % Columns == Columns - 1)
      + {
      + msg_screen_putchar('>', hl_attr(HLF_AT));
      + continue;
      + }
      + else
      + {
      + char_u mbyte[3]; /* only for dbcs */
      +
      + mbyte[0] = *s;
      + mbyte[1] = *(s + 1);
      + mbyte[2] = NUL;
      + screen_puts(mbyte, msg_row, msg_col, attr);
      + if ((msg_col += 2) >= Columns)
      + {
      + msg_col = 0;
      + ++msg_row;
      + }
      + ++s;
      + }
      + }
      + #endif
      else
      msg_screen_putchar(*s, attr);
      ++s;
      *** ../vim-5.6.86/src/misc2.c Sun Jun 4 20:25:26 2000
      --- src/misc2.c Mon Jun 5 12:44:32 2000
      ***************
      *** 673,678 ****
      --- 673,686 ----
      length = 1; /* count the trailing '/' and NUL */
      for (p = string; *p; p++)
      {
      + #ifdef MULTI_BYTE
      + if (is_dbcs && *(p + 1) != NUL && IsLeadByte(*p))
      + {
      + length += 2;
      + ++p; /* skip multibyte */
      + continue;
      + }
      + #endif
      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 && *(p + 1) != NUL && IsLeadByte(*p))
      + {
      + *p2++ = *p++; /* skip multibyte lead */
      + *p2++ = *p; /* skip multibyte trail */
      + continue;
      + }
      + #endif
      if (vim_strchr(esc_chars, *p) != NULL)
      *p2++ = '\\';
      *p2++ = *p;
      *** ../vim-5.6.86/src/screen.c Thu Apr 13 12:02:05 2000
      --- src/screen.c Mon Jun 5 12:56:31 2000
      ***************
      *** 3211,3232 ****
      int attr;
      {
      char_u *screenp;

      if (NextScreen != NULL && row < Rows) /* safety check */
      {
      screenp = LinePointers[row] + col;
      while (*text && col < Columns)
      {
      ! if (*screenp != *text || *(screenp + Columns) != attr ||
      ! exmode_active)
      {
      *screenp = *text;
      *(screenp + Columns) = attr;
      screen_char(screenp, row, col);
      }
      - ++screenp;
      - ++col;
      - ++text;
      }
      }
      }
      --- 3211,3265 ----
      int attr;
      {
      char_u *screenp;
      + #ifdef MULTI_BYTE
      + int is_mbyte;
      + #endif

      if (NextScreen != NULL && row < Rows) /* safety check */
      {
      screenp = LinePointers[row] + col;
      while (*text && col < Columns)
      {
      ! #ifdef MULTI_BYTE
      ! /* check if this is the first byte of a multibyte */
      ! if (is_dbcs && text[1] != NUL && IsLeadByte(*text))
      ! is_mbyte = 1;
      ! else
      ! is_mbyte = 0;
      ! #endif
      ! if (*screenp != *text
      ! #ifdef MULTI_BYTE
      ! || (is_mbyte && screenp[1] != text[1])
      ! #endif
      ! || *(screenp + Columns) != attr
      ! || exmode_active)
      {
      *screenp = *text;
      *(screenp + Columns) = attr;
      screen_char(screenp, row, col);
      + #ifdef MULTI_BYTE
      + if (is_mbyte)
      + {
      + screenp[1] = text[1];
      + screenp[Columns + 1] = attr;
      + screen_char(screenp + 1, row, col + 1);
      + }
      + #endif
      + }
      + #ifdef MULTI_BYTE
      + if (is_mbyte)
      + {
      + screenp += 2;
      + col += 2;
      + text += 2;
      + }
      + else
      + #endif
      + {
      + ++screenp;
      + ++col;
      + ++text;
      }
      }
      }
      }
      *** ../vim-5.6.86/src/version.c Mon Jun 5 12:25:41 2000
      --- src/version.c Mon Jun 5 13:04:55 2000
      ***************
      *** 420,421 ****
      --- 420,423 ----
      { /* Add new patch number below this line */
      + /**/
      + 87,
      /**/

      --
      CART DRIVER: Bring out your dead!
      We follow the cart through a wretched, impoverished plague-ridden village.
      A few starved mongrels run about in the mud scavenging. In the open
      doorway of one house perhaps we jug glimpse a pair of legs dangling from
      the ceiling. In another doorway an OLD WOMAN is beating a cat against a
      wall rather like one does with a mat. The cart passes round a dead donkey
      or cow in the mud. And a MAN tied to a cart is being hammered to death by
      four NUNS with huge mallets.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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