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

vim56-p87 problem

Expand Messages
  • Sung-Hyun Nam
    Hello, Today, I applied vim56 p73 - p90. And found a one problem from p87. I have no problem if I do :!cat file (Don t know the routine called by this
    Message 1 of 4 , Jun 6, 2000
    • 0 Attachment
      Hello,

      Today, I applied vim56 p73 - p90. And found a one problem
      from p87.
      I have no problem if I do ':!cat file' (Don't know the routine
      called by this command).
      But multibyte corrupted if I do ':echo info'.
      (I did, let info='multibyte string').
      I need next patch to avoid my problem though I doubt it is not
      real patch.

      regards,

      diff -u -u -r1.13.4.1 message.c
      --- ./src/message.c 2000/06/06 08:04:16 1.13.4.1
      +++ ./src/message.c 2000/06/06 09:12:03
      @@ -859,7 +859,7 @@
      {
      #ifdef MULTI_BYTE
      /* check multibyte */
      - if (is_dbcs && *(str + 1) != NUL && IsLeadByte(*str))
      + if (is_dbcs && len > 0 && *(str + 1) != NUL && IsLeadByte(*str))
      {
      char_u buf[3];
    • Bram Moolenaar
      ... I can see the problem. The code checked for a NUL instead of using the len argument. I ll include this patch, thanks! Besides this change, it looks
      Message 2 of 4 , Jun 6, 2000
      • 0 Attachment
        Sung-Hyun Nam wrote:

        > Today, I applied vim56 p73 - p90. And found a one problem from p87.
        > I have no problem if I do ':!cat file' (Don't know the routine
        > called by this command).
        > But multibyte corrupted if I do ':echo info'.
        > (I did, let info='multibyte string').
        > I need next patch to avoid my problem though I doubt it is not real patch.

        I can see the problem. The code checked for a NUL instead of using the "len"
        argument. I'll include this patch, thanks!

        Besides this change, it looks like the do_echo() function should also check
        for a multi-byte character. Try adding the patch below. It should only make
        a difference when the second byte of a multi-byte is a '\n', '\r' or Tab
        character. And perhaps at the end of the line.


        *** eval.c.orig Fri Mar 31 14:23:11 2000
        --- eval.c Tue Jun 6 12:55:14 2000
        ***************
        *** 4663,4669 ****
        msg_putchar_attr(*p, echo_attr);
        }
        else
        ! (void)msg_outtrans_len_attr(p, 1, echo_attr);
        }
        clear_var(&retvar);
        arg = skipwhite(arg);
        --- 4663,4680 ----
        msg_putchar_attr(*p, echo_attr);
        }
        else
        ! {
        ! #ifdef MULTI_BYTE
        ! /* check multibyte */
        ! if (is_dbcs && p[1] != NUL && IsLeadByte(*p))
        ! {
        ! (void)msg_outtrans_len_attr(p, 2, echo_attr);
        ! ++p;
        ! }
        ! else
        ! #endif
        ! (void)msg_outtrans_len_attr(p, 1, echo_attr);
        ! }
        }
        clear_var(&retvar);
        arg = skipwhite(arg);
        --
        BLACK KNIGHT: None shall pass.
        ARTHUR: I have no quarrel with you, brave Sir knight, but I must cross
        this bridge.
        BLACK KNIGHT: Then you shall die.
        "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 --/-/
      • Taro Muraoka
        Hello, Sung-Hyun Nam, Bram Moolenaar, and vim-multibyte. ... There is lack of codes in patch-5.6.87. In patch I last sended to vim-multibyte, it included
        Message 3 of 4 , Jun 6, 2000
        • 0 Attachment
          Hello, Sung-Hyun Nam, Bram Moolenaar, and vim-multibyte.

          > I have no problem if I do ':!cat file' (Don't know the routine
          > called by this command).
          > But multibyte corrupted if I do ':echo info'.
          > (I did, let info='multibyte string').

          There is lack of codes in patch-5.6.87. In patch I last sended to
          vim-multibyte, it included patch to eval.c(do_echo).

          Function do_echo() outputs bytes of message one by one, using function
          msg_outtrans_len_attr(). Function msg_outtrans_len_attr() force outputs
          a character at a time. When a lead byte of multibyte-character was
          passed to msg_outtrans_len_attr(), it and additionally trail byte are
          outputed. Then do_echo() try to output a trail byte of multibyte. It
          cause confusion.

          Patch I last sended, make do_echo() skip trail byte. Please try it.
          ----
          Taro Muraoka <koron@...>


          diff -cr src.orig/eval.c src/eval.c
          *** src.orig/eval.c Sat Apr 01 00:21:22 2000
          --- src/eval.c Mon May 29 16:36:18 2000
          ***************
          *** 4652,4657 ****
          --- 4652,4658 ----
          else if (echo)
          msg_puts_attr((char_u *)" ", echo_attr);
          for (p = get_var_string(&retvar); *p != NUL && !got_int; ++p)
          + {
          if (*p == '\n' || *p == '\r' || *p == TAB)
          {
          if (*p != TAB && needclr)
          ***************
          *** 4663,4669 ****
          --- 4664,4677 ----
          msg_putchar_attr(*p, echo_attr);
          }
          else
          + {
          (void)msg_outtrans_len_attr(p, 1, echo_attr);
          + #ifdef MULTI_BYTE
          + if (is_dbcs && *(p + 1) && IsLeadByte(*p))
          + ++p;
          + #endif
          + }
          + }
          }
          clear_var(&retvar);
          arg = skipwhite(arg);
        • Sung-Hyun Nam
          ... Hello, I believe Bram s patch is correct. And it seems Bram s patch works fine. regards, namsh
          Message 4 of 4 , Jun 6, 2000
          • 0 Attachment
            Taro Muraoka wrote:
            > Hello, Sung-Hyun Nam, Bram Moolenaar, and vim-multibyte.
            >
            > > I have no problem if I do ':!cat file' (Don't know the routine
            > > called by this command).
            > > But multibyte corrupted if I do ':echo info'.
            > > (I did, let info='multibyte string').
            >
            > There is lack of codes in patch-5.6.87. In patch I last sended to
            > vim-multibyte, it included patch to eval.c(do_echo).
            >
            > Function do_echo() outputs bytes of message one by one, using function
            > msg_outtrans_len_attr(). Function msg_outtrans_len_attr() force outputs
            > a character at a time. When a lead byte of multibyte-character was
            > passed to msg_outtrans_len_attr(), it and additionally trail byte are
            > outputed. Then do_echo() try to output a trail byte of multibyte. It
            > cause confusion.

            Hello,

            I believe Bram's patch is correct. And it seems Bram's patch works
            fine.

            regards,

            namsh
          Your message has been successfully submitted and would be delivered to recipients shortly.