0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.1045: E315 ml_get error when using Python and hidden buffer

Problem:    E315 ml_get error when using Python and hidden buffer.
Solution:   Make sure the cursor position is valid. (Ben Jackson,
            closes #4153, closes #4154)
This commit is contained in:
Bram Moolenaar
2019-03-23 17:41:59 +01:00
parent c3e92c161d
commit 63dbfd33c1
4 changed files with 178 additions and 2 deletions

View File

@@ -4392,7 +4392,10 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
RAISE_DELETE_LINE_FAIL;
else
{
if (buf == curbuf)
if (buf == curbuf && (save_curwin != NULL
|| save_curbuf.br_buf == NULL))
// Using an existing window for the buffer, adjust the cursor
// position.
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
if (save_curbuf.br_buf == NULL)
/* Only adjust marks if we managed to switch to a window that
@@ -4642,7 +4645,10 @@ SetBufferLineList(
(long)MAXLNUM, (long)extra);
changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
if (buf == curbuf)
if (buf == curbuf && (save_curwin != NULL
|| save_curbuf.br_buf == NULL))
// Using an existing window for the buffer, adjust the cursor
// position.
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
/* END of region without "return". */