diff options
-rw-r--r-- | src/nvim/runtime.c | 3 | ||||
-rw-r--r-- | test/old/testdir/test_source.vim | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 85af98f9ce..86ca4f08dc 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -2726,6 +2726,7 @@ static char *get_one_sourceline(source_cookie_T *sp) ga_grow(&ga, 1); buf = (char *)ga.ga_data; buf[ga.ga_len++] = NUL; + len = ga.ga_len; } else { buf = ga.ga_data; retry: @@ -2736,8 +2737,8 @@ retry: } break; } + len = ga.ga_len + (int)strlen(buf + ga.ga_len); } - len = ga.ga_len + (int)strlen(buf + ga.ga_len); #ifdef USE_CRNL // Ignore a trailing CTRL-Z, when in Dos mode. Only recognize the // CTRL-Z by its own, or after a NL. diff --git a/test/old/testdir/test_source.vim b/test/old/testdir/test_source.vim index a8111eb03d..10b00d3784 100644 --- a/test/old/testdir/test_source.vim +++ b/test/old/testdir/test_source.vim @@ -644,6 +644,17 @@ func Test_source_buffer_long_line() norm300gr0 so bwipe! + + let lines =<< trim END + new + norm 10a0000000000ΓΈ00000000000 + norm i0000000000000000000 + silent! so + END + call writefile(lines, 'Xtest.vim') + source Xtest.vim + bwipe! + call delete('Xtest.vim') endfunc |