Patch 7.4.1998
Problem:    When writing buffer lines to a job there is no NL to NUL
            conversion.
Solution:   Make it work symmetrical with writing lines from a job into a
            buffer.
Files:      src/channel.c, src/proto/channel.pro, src/netbeans.c


*** ../vim-7.4.1997/src/channel.c       2016-06-27 21:10:28.148544550 +0200
--- src/channel.c       2016-07-07 20:34:30.485913884 +0200
***************
*** 1313,1326 ****
      char_u  *line = ml_get_buf(buf, lnum, FALSE);
      int           len = (int)STRLEN(line);
      char_u  *p;
  
      /* 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()");
      vim_free(p);
  }
  
--- 1313,1332 ----
      char_u  *line = ml_get_buf(buf, lnum, FALSE);
      int           len = (int)STRLEN(line);
      char_u  *p;
+     int           i;
  
      /* 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);
+ 
+     for (i = 0; i < len; ++i)
+       if (p[i] == NL)
+           p[i] = NUL;
+ 
      p[len] = NL;
      p[len + 1] = NUL;
!     channel_send(channel, PART_IN, p, len + 1, "write_buf_line()");
      vim_free(p);
  }
  
***************
*** 2185,2191 ****
                {
                    channel_send(channel,
                                 part == PART_SOCK ? PART_SOCK : PART_IN,
!                                json, (char *)cmd);
                    vim_free(json);
                }
            }
--- 2191,2197 ----
                {
                    channel_send(channel,
                                 part == PART_SOCK ? PART_SOCK : PART_IN,
!                                json, (int)STRLEN(json), (char *)cmd);
                    vim_free(json);
                }
            }
***************
*** 3380,3388 ****
   * Return FAIL or OK.
   */
      int
! channel_send(channel_T *channel, int part, char_u *buf, char *fun)
  {
-     int               len = (int)STRLEN(buf);
      int               res;
      sock_T    fd;
  
--- 3386,3393 ----
   * Return FAIL or OK.
   */
      int
! channel_send(channel_T *channel, int part, char_u *buf, int len, char *fun)
  {
      int               res;
      sock_T    fd;
  
***************
*** 3470,3476 ****
                                       opt->jo_callback, opt->jo_partial, id);
      }
  
!     if (channel_send(channel, part_send, text, fun) == OK
                                                  && opt->jo_callback == NULL)
        return channel;
      return NULL;
--- 3475,3481 ----
                                       opt->jo_callback, opt->jo_partial, id);
      }
  
!     if (channel_send(channel, part_send, text, (int)STRLEN(text), fun) == OK
                                                  && opt->jo_callback == NULL)
        return channel;
      return NULL;
*** ../vim-7.4.1997/src/proto/channel.pro       2016-06-07 22:16:31.690333465 
+0200
--- src/proto/channel.pro       2016-07-07 20:34:13.042176488 +0200
***************
*** 34,40 ****
  void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
  channel_T *channel_fd2channel(sock_T fd, int *partp);
  void channel_handle_events(void);
! int channel_send(channel_T *channel, int part, char_u *buf, char *fun);
  channel_T *send_common(typval_T *argvars, char_u *text, int id, int eval, 
jobopt_T *opt, char *fun, int *part_read);
  void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval);
  void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval);
--- 34,40 ----
  void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
  channel_T *channel_fd2channel(sock_T fd, int *partp);
  void channel_handle_events(void);
! int channel_send(channel_T *channel, int part, char_u *buf, int len, char 
*fun);
  channel_T *send_common(typval_T *argvars, char_u *text, int id, int eval, 
jobopt_T *opt, char *fun, int *part_read);
  void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval);
  void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval);
*** ../vim-7.4.1997/src/netbeans.c      2016-07-01 17:17:13.290266761 +0200
--- src/netbeans.c      2016-07-07 20:33:54.454456314 +0200
***************
*** 765,771 ****
  nb_send(char *buf, char *fun)
  {
      if (nb_channel != NULL)
!       channel_send(nb_channel, PART_SOCK, (char_u *)buf, fun);
  }
  
  /*
--- 765,772 ----
  nb_send(char *buf, char *fun)
  {
      if (nb_channel != NULL)
!       channel_send(nb_channel, PART_SOCK, (char_u *)buf,
!                                                      (int)STRLEN(buf), fun);
  }
  
  /*
*** ../vim-7.4.1997/src/version.c       2016-07-07 18:58:55.368713570 +0200
--- src/version.c       2016-07-07 20:44:13.125141617 +0200
***************
*** 760,761 ****
--- 760,763 ----
  {   /* Add new patch number below this line */
+ /**/
+     1998,
  /**/

-- 
Your fault: core dumped

 /// 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