To: vim-dev@vim.org Subject: Patch 6.2.150 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.150 Problem: When doing "vim - < file" lines are broken at NUL chars. (Daniel Goujot) Solution: Change NL characters back to NUL when reading from the temp buffer. Files: src/fileio.c *** ../vim-6.2.149/src/fileio.c Sun Nov 9 20:20:26 2003 --- src/fileio.c Mon Nov 10 10:14:19 2003 *************** *** 1091,1097 **** size = 0; else { ! int n; long tlen; tlen = 0; --- 1091,1097 ---- size = 0; else { ! int n, ni; long tlen; tlen = 0; *************** *** 1101,1117 **** n = (int)STRLEN(p); if ((int)tlen + n + 1 > size) { ! /* Filled up to "size", append partial line. */ n = size - tlen; ! mch_memmove(ptr + tlen, p, (size_t)n); read_buf_col += n; break; } else { ! /* Append whole line and new-line. */ ! mch_memmove(ptr + tlen, p, (size_t)n); ! tlen += n; ptr[tlen++] = NL; read_buf_col = 0; if (++read_buf_lnum > from) --- 1101,1131 ---- n = (int)STRLEN(p); if ((int)tlen + n + 1 > size) { ! /* Filled up to "size", append partial line. ! * Change NL to NUL to reverse the effect done ! * below. */ n = size - tlen; ! for (ni = 0; ni < n; ++ni) ! { ! if (p[ni] == NL) ! ptr[tlen++] = NUL; ! else ! ptr[tlen++] = p[ni]; ! } read_buf_col += n; break; } else { ! /* Append whole line and new-line. Change NL ! * to NUL to reverse the effect done below. */ ! for (ni = 0; ni < n; ++ni) ! { ! if (p[ni] == NL) ! ptr[tlen++] = NUL; ! else ! ptr[tlen++] = p[ni]; ! } ptr[tlen++] = NL; read_buf_col = 0; if (++read_buf_lnum > from) *** ../vim-6.2.149/src/version.c Sun Nov 9 20:35:08 2003 --- src/version.c Wed Nov 12 20:38:53 2003 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 150, /**/ -- hundred-and-one symptoms of being an internet addict: 6. You refuse to go to a vacation spot with no electricity and no phone lines. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///