1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: readline() does not return the last line when the NL is missing.
13 Solution: When at the end of the file Also check for a previous line.
17 *** ../vim-7.3.149/src/eval.c 2011-03-27 16:03:09.000000000 +0200
18 --- src/eval.c 2011-04-01 16:06:04.000000000 +0200
22 if (buf[filtd] == '\n' || readlen <= 0)
24 ! /* Only when in binary mode add an empty list item when the
25 ! * last line ends in a '\n'. */
26 ! if (!binary && readlen == 0 && filtd == 0)
29 /* Found end-of-line or end-of-file: add a text line to the
32 if (buf[filtd] == '\n' || readlen <= 0)
34 ! /* In binary mode add an empty list item when the last
35 ! * non-empty line ends in a '\n'. */
36 ! if (!binary && readlen == 0 && filtd == 0 && prev == NULL)
39 /* Found end-of-line or end-of-file: add a text line to the
45 ! /* "buf" is full, need to move text to an allocated buffer */
48 ! prev = vim_strnsave(buf, buflen);
53 ! s = alloc((unsigned)(prevlen + buflen));
56 ! mch_memmove(s, prev, prevlen);
57 ! mch_memmove(s + prevlen, buf, buflen);
71 ! if (buflen >= FREAD_SIZE / 2)
73 ! /* "buf" is full, need to move text to an allocated buffer */
76 ! prev = vim_strnsave(buf, buflen);
81 ! s = alloc((unsigned)(prevlen + buflen));
84 ! mch_memmove(s, prev, prevlen);
85 ! mch_memmove(s + prevlen, buf, buflen);
96 *** ../vim-7.3.149/src/version.c 2011-04-01 15:33:54.000000000 +0200
97 --- src/version.c 2011-04-01 16:04:42.000000000 +0200
101 { /* Add new patch number below this line */
107 ARTHUR: What are you going to do. bleed on me?
108 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
110 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
111 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
112 \\\ an exciting new programming language -- http://www.Zimbu.org ///
113 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///