Patch 7.4.1965
Problem:    When using a job in raw mode to append to a buffer garbage
            characters are added.
Solution:   Do not replace the trailing NUL with a NL. (Ozaki Kiichi)
Files:      src/channel.c, src/testdir/test_channel.vim


*** ../vim-7.4.1964/src/channel.c       2016-06-26 17:30:59.506206686 +0200
--- src/channel.c       2016-06-27 21:06:39.352572000 +0200
***************
*** 1317,1323 ****
      /* Need to make a copy to be able to append a NL. */
      if ((p = alloc(len + 2)) == NULL)
        return;
!     STRCPY(p, line);
      p[len] = NL;
      p[len + 1] = NUL;
      channel_send(channel, PART_IN, p, "write_buf_line()");
--- 1317,1323 ----
      /* Need to make a copy to be able to append a NL. */
      if ((p = alloc(len + 2)) == NULL)
        return;
!     memcpy((char *)p, (char *)line, len);
      p[len] = NL;
      p[len + 1] = NUL;
      channel_send(channel, PART_IN, p, "write_buf_line()");
***************
*** 1616,1622 ****
  {
      readq_T *head = &channel->ch_part[part].ch_head;
      readq_T *node = head->rq_next;
!     long_u  len = 1;
      char_u  *res;
      char_u  *p;
  
--- 1616,1622 ----
  {
      readq_T *head = &channel->ch_part[part].ch_head;
      readq_T *node = head->rq_next;
!     long_u  len = 0;
      char_u  *res;
      char_u  *p;
  
***************
*** 1627,1633 ****
      /* Concatenate everything into one buffer. */
      for (node = head->rq_next; node != NULL; node = node->rq_next)
        len += node->rq_buflen;
!     res = lalloc(len, TRUE);
      if (res == NULL)
        return NULL;
      p = res;
--- 1627,1633 ----
      /* Concatenate everything into one buffer. */
      for (node = head->rq_next; node != NULL; node = node->rq_next)
        len += node->rq_buflen;
!     res = lalloc(len + 1, TRUE);
      if (res == NULL)
        return NULL;
      p = res;
*** ../vim-7.4.1964/src/testdir/test_channel.vim        2016-06-10 
23:02:52.950729704 +0200
--- src/testdir/test_channel.vim        2016-06-27 21:01:39.993859966 +0200
***************
*** 1018,1023 ****
--- 1018,1045 ----
    call job_stop(job)
  endfunc
  
+ func Test_pipe_to_buffer_raw()
+   if !has('job')
+     return
+   endif
+   call ch_log('Test_raw_pipe_to_buffer()')
+   let options = {'out_mode': 'raw', 'out_io': 'buffer', 'out_name': 'testout'}
+   split testout
+   let job = job_start([s:python, '-c', 
+         \ 'import sys; [sys.stdout.write(".") and sys.stdout.flush() for _ in 
range(10000)]'], options)
+   call assert_equal("run", job_status(job))
+   call s:waitFor('len(join(getline(2,line("$")),"") >= 10000')
+   try
+     for line in getline(2, '$')
+       let line = substitute(line, '^\.*', '', '')
+       call assert_equal('', line)
+     endfor
+   finally
+     call job_stop(job)
+     bwipe!
+   endtry
+ endfunc
+ 
  func Test_reuse_channel()
    if !has('job')
      return
*** ../vim-7.4.1964/src/version.c       2016-06-26 22:05:50.329740164 +0200
--- src/version.c       2016-06-27 21:03:17.884128650 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1965,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
152. You find yourself falling for someone you've never seen or hardly
     know, but, boy can he/she TYPE!!!!!!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui