diff options
-rw-r--r-- | src/nvim/runtime.c | 2 | ||||
-rw-r--r-- | test/old/testdir/test_source.vim | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 209afcdc4a..85af98f9ce 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2723,7 +2723,9 @@ static char *get_one_sourceline(source_cookie_T *sp) } ga_concat(&ga, ((char **)sp->buflines.ga_data)[sp->buf_lnum]); sp->buf_lnum++; + ga_grow(&ga, 1); buf = (char *)ga.ga_data; + buf[ga.ga_len++] = NUL; } else { buf = ga.ga_data; retry: diff --git a/test/old/testdir/test_source.vim b/test/old/testdir/test_source.vim index 026a4bb5ee..a8111eb03d 100644 --- a/test/old/testdir/test_source.vim +++ b/test/old/testdir/test_source.vim @@ -638,4 +638,13 @@ func Test_source_buffer_vim9() %bw! endfunc +func Test_source_buffer_long_line() + " This was reading past the end of the line. + new + norm300gr0 + so + bwipe! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |