aboutsummaryrefslogtreecommitdiff
path: root/src/offset.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-17 16:12:51 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 13:41:55 +0200
commitcb4e9cf7cfc1612c67f16bfabadbdf442cd380fe (patch)
tree5aa2bf7dccafe66d735f3609d446bfad083ab8a3 /src/offset.rs
parentc15895d44d17984386d3684e2aa85aca386ba3bf (diff)
fix: fix lots of position off-by-ones
Previously the PosTrackingReader always mysteriously subtracted 1 from the current position ... this wasn't sound at all ... the machine just happens to often call `Tokenizer::unread_char` ... but not always. E.g. for proper comments it didn't which resulted in their offset and spans being off-by-one, which is fixed by this commit (see test_spans.rs).
Diffstat (limited to 'src/offset.rs')
-rw-r--r--src/offset.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/offset.rs b/src/offset.rs
index 8809366..3152c78 100644
--- a/src/offset.rs
+++ b/src/offset.rs
@@ -68,7 +68,7 @@ impl<R> PosTrackingReader<R> {
impl<R> Position<usize> for PosTrackingReader<R> {
fn position(&self) -> usize {
- self.position - 1
+ self.position
}
}