Skip to content

Commit

Permalink
Add warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vidy committed Dec 9, 2024
1 parent ea8ddf1 commit 51bd665
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,6 @@ fn split<E: Encoder>(boxes: &mut [(RectF, usize)], spans: &[TextSpan<E>], lines:
return Node::singleton(boxes);
}

// for b in boxes.iter(){
// dbg!(b.0, b.1, spans.get(b.1).unwrap().text.as_str());
// }

sort_x(boxes);
let max_x_gap = dist_x(boxes);

Expand Down Expand Up @@ -381,8 +377,11 @@ fn split<E: Encoder>(boxes: &mut [(RectF, usize)], spans: &[TextSpan<E>], lines:
return split2(boxes, spans, lines);
}

assert!(
x_gaps.len() > 0 || y_gaps.len() > 0,
"At least one of x_gaps and y_gaps must be non-empty, otherwise the memory will be exhausted"
);
sort_y(boxes);

for row in split_by(boxes, &y_gaps, |r| r.min_y()) {
if x_gaps.len() > 0 {
sort_x(row);
Expand All @@ -396,7 +395,6 @@ fn split<E: Encoder>(boxes: &mut [(RectF, usize)], spans: &[TextSpan<E>], lines:
}
}

assert!(x_gaps.len() > 0 || y_gaps.len() > 0);
let tag = if y_gaps.len() == 0 {
if cells.iter().all(|n| n.tag() <= NodeTag::Line) {
NodeTag::Line
Expand Down

0 comments on commit 51bd665

Please sign in to comment.