kisielk / vigo

Vi in Go
Other
168 stars 17 forks source link

buffer/cursor: Handle EOF in ExtractCursor without crashing, add tests #27

Closed dtcaciuc closed 10 years ago

dtcaciuc commented 10 years ago

Bah, wrong method name in description.

kisielk commented 10 years ago

Thanks. That fixes the bug at least. I'm wondering if whenever we insert a \n we should also subtract from n.

dtcaciuc commented 10 years ago

Good question. Right now it does. You get back a single array of bytes so if we allow extraction across lines, newline characters have to be there. Since newlines are characters like every other, to retain the "request N bytes, get N bytes" behaviour, it should in fact subtract from n.

kisielk commented 10 years ago

Oh, it does right now. For some reason when I read the code, it seemed like it didn't.