@jyapayne, I might be doing something differently, but here's what I'm finding.
1. Go to a line that exceeds the buffer size (e.g., the line starting with
#CHROM; I assume you're testing on
`ALL.chrX.phase3_shapeit2_mvncall_integrated_v1b.20130502.genotypes.vcf.gz`)
2. Search for `CHROM`, and I believe you'll find at least one additional
occurrence of it on that line (there should only be one)
I haven't worked with pointers since college, so I may not be following
everything correctly, but I believe the bug is in the following conditional
statement:
if data[last] == '\l':
buffer.add data[last+1 ..< pos]
Run
Essentially, on any line that exceeds the buffer, I think it's adding
everything from the beginning of the buffer to the new `pos` value, because
`last` is not updating. I assume it breaks out of that loop once it gets to the
end of that line and encounters `\L`.
I hope I'm not making you chase a non-existent bug, but I don't see that I'm
making any errors.