alpaylan / tail

Tail, a typed and structured document editor
https://tail.rocks
87 stars 8 forks source link

Turn Linear Search Into Binary Search for Width Calculation #5

Closed alpaylan closed 4 months ago

alpaylan commented 1 year ago

In src/element.rs line 141, break_lines function calculates lines by doing a linear search until it finds the cutoff point. This can be easily turned into a binary search.