Skip to content

Commit 8293f75

Browse files
committed
Fix handling of final unmatched text in ssed
1 parent 8544b03 commit 8293f75

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

examples/ad_regex/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/ad_regex/src/stream.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,12 @@ mod impl_structex {
263263
}
264264

265265
fn max_len(&self) -> usize {
266-
usize::MAX
266+
if self.is_closed() {
267+
let inner = self.inner.borrow();
268+
inner.cleared_bytes + inner.gb.len()
269+
} else {
270+
usize::MAX
271+
}
267272
}
268273
}
269274

examples/ssed/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,9 @@ where
102102
(after_match)(h, &caps);
103103
}
104104

105+
if pos < h.max_len() {
106+
h.slice(pos..h.max_len()).write_to(&mut stdout())?;
107+
}
108+
105109
Ok(())
106110
}

0 commit comments

Comments
 (0)