neovim/neovim — pull request #1255 by splinterofchaos (2014-09-28 02:27:22+00:00)
Title: [RFC] Set `v:job_data[2]` line-wise. (#1243)

As mentioned in #1243, `v:job_data[2]` should contain line-wise data and a partial read may corrupt it. This is one possible solution:

I thought maybe `rstream` is a low-level API and the solution should be in the logic for jobs, but `rstream` clients cannot view the buffer's contents before reading, so the API has to help on some level to find the new-line character. This implements `rstream_read_lines()`, which returns the buffer contents up to and including the last new line character.

A more sophisticated API might tell the user how many bytes until the last new line, but the buffer may need to grow or make space and that seemed to expose too much of the inner-logic, having the client manage the edge cases.

Vroom tests failed on travis, but not locally, so I don't think I broke them.