0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

updated for version 7.0012

This commit is contained in:
Bram Moolenaar
2004-07-26 12:53:41 +00:00
parent 89cb5e0f64
commit 5eb86f9199
42 changed files with 1362 additions and 648 deletions

View File

@@ -2731,6 +2731,7 @@ StringToLine(PyObject *obj)
char *save;
int len;
int i;
char *p;
if (obj == NULL || !PyString_Check(obj))
{
@@ -2741,14 +2742,22 @@ StringToLine(PyObject *obj)
str = PyString_AsString(obj);
len = PyString_Size(obj);
/* Error checking: String must not contain newlines, as we
/*
* Error checking: String must not contain newlines, as we
* are replacing a single line, and we must replace it with
* a single line.
* A trailing newline is removed, so that append(f.readlines()) works.
*/
if (memchr(str, '\n', len))
p = memchr(str, '\n', len);
if (p != NULL)
{
PyErr_SetVim(_("string cannot contain newlines"));
return NULL;
if (p == str + len - 1)
--len;
else
{
PyErr_SetVim(_("string cannot contain newlines"));
return NULL;
}
}
/* Create a copy of the string, with internal nulls replaced by