Skip to content

Commit 6fef73b

Browse files
authored
Bug fix for bytes->chars translation in SplitRecursively (#130)
1 parent 50dd0ee commit 6fef73b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ops/functions/split_recursively.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ fn translate_bytes_to_chars<'a>(text: &str, offsets: impl Iterator<Item = &'a mu
317317
}
318318

319319
// Offsets after the last char.
320+
**next_offset = char_idx;
320321
for offset in offsets_iter {
321322
**offset = char_idx;
322323
}
@@ -366,7 +367,9 @@ impl SimpleFunctionExecutor for Executor {
366367
full_text,
367368
output
368369
.iter_mut()
369-
.map(|(range, _)| [&mut range.start, &mut range.end].into_iter())
370+
.map(|(range, _)| {
371+
std::iter::once(&mut range.start).chain(std::iter::once(&mut range.end))
372+
})
370373
.flatten(),
371374
);
372375

0 commit comments

Comments
 (0)