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

Re: [vim-multibyte] vim56-p87 problem

Expand Messages
  • 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 1 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 --/-/
    • Sung-Hyun Nam
      ... Hello, I believe Bram s patch is correct. And it seems Bram s patch works fine. regards, namsh
      Message 2 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.