mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
updated for version 7.3.943
Problem: Python: Negative indices were failing. Solution: Fix negative indices. Add tests. (ZyX)
This commit is contained in:
@@ -2394,6 +2394,9 @@ RBItem(BufferObject *self, PyInt n, PyInt start, PyInt end)
|
||||
if (end == -1)
|
||||
end = self->buf->b_ml.ml_line_count;
|
||||
|
||||
if (n < 0)
|
||||
n += end - start + 1;
|
||||
|
||||
if (n < 0 || n > end - start)
|
||||
{
|
||||
PyErr_SetString(PyExc_IndexError, _("line number out of range"));
|
||||
@@ -2441,6 +2444,9 @@ RBAsItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyI
|
||||
if (end == -1)
|
||||
end = self->buf->b_ml.ml_line_count;
|
||||
|
||||
if (n < 0)
|
||||
n += end - start + 1;
|
||||
|
||||
if (n < 0 || n > end - start)
|
||||
{
|
||||
PyErr_SetString(PyExc_IndexError, _("line number out of range"));
|
||||
|
Reference in New Issue
Block a user