0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

updated for version 7.3.150

Problem:    readline() does not return the last line when the NL is missing.
            (Hong Xu)
Solution:   When at the end of the file Also check for a previous line.
This commit is contained in:
Bram Moolenaar
2011-04-01 16:07:46 +02:00
parent 96bcc5e6cd
commit 27b6056d85
2 changed files with 23 additions and 18 deletions

View File

@@ -14305,9 +14305,9 @@ f_readfile(argvars, rettv)
{
if (buf[filtd] == '\n' || readlen <= 0)
{
/* Only when in binary mode add an empty list item when the
* last line ends in a '\n'. */
if (!binary && readlen == 0 && filtd == 0)
/* In binary mode add an empty list item when the last
* non-empty line ends in a '\n'. */
if (!binary && readlen == 0 && filtd == 0 && prev == NULL)
break;
/* Found end-of-line or end-of-file: add a text line to the
@@ -14371,6 +14371,8 @@ f_readfile(argvars, rettv)
break;
if (tolist == 0)
{
if (buflen >= FREAD_SIZE / 2)
{
/* "buf" is full, need to move text to an allocated buffer */
if (prev == NULL)
@@ -14392,6 +14394,7 @@ f_readfile(argvars, rettv)
}
filtd = 0;
}
}
else
{
mch_memmove(buf, buf + tolist, buflen - tolist);

View File

@@ -714,6 +714,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
150,
/**/
149,
/**/