BurntSushi / BurntSushi/rust-csv
`Position::line` reports inaccurate line following blank lines
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
#### What version of the `csv` crate are you using?
`1.1.3`
#### Briefly describe the question, bug or feature request.
`Reader` reasonably skips blank lines, and the reported position following them is largely still correct, except for the first record following the blank. The first record after a blank line reports the blank's line number rather than its own.
#### Include a complete program demonstrating a problem.
Rust program:
```rust
fn main() {
let mut rdr = csv::Reader::from_reader(std::io::stdin());
for result in rdr.records() {
let record = result.unwrap();
let expected: u64 = record.get(0).unwrap().parse().unwrap();
let actual = record.position().unwrap().line();
if expected != actual {
println!("expected: {}", expected);
println!("actual: {}", actual);
}
}
}
```
With CSV input:
```csv
line number
2
4
5
```
#### What is the observed behavior of the code above?
```
expected: 4
actual: 3
```
#### What is the expected or desired behavior of the code above?
No output.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.