···5566# Changelog
7788+## Unreleased
99+1010+### Bug fixes
1111+1212+- Fixed a bug where the compiler would crash when wrapping an error message
1313+ whose line broke in the middle of a multi-byte UTF-8 character.
1414+ ([John Downey](https://github.com/jtdowney))
1515+816## v1.18.0-rc1 - 2026-07-21
9171018### Compiler
···53075307// breaks word into n lines based on width. Returns list of new lines and remainder
53085308fn break_word(word: &str, width: usize) -> (Vec<Cow<'_, str>>, &str) {
53095309 let mut new_lines: Vec<Cow<'_, str>> = Vec::new();
53105310- let (first, mut remainder) = word.split_at(width);
53105310+ // split on a char boundary so a multi-byte UTF-8 char straddling `width`
53115311+ // can't panic.
53125312+ let (first, mut remainder) = word.split_at(word.floor_char_boundary(width));
53115313 new_lines.push(Cow::from(first));
5312531453135315 // split remainder until it's small enough
53145316 while remainder.len() > width {
53155315- let (first, second) = remainder.split_at(width);
53175317+ let (first, second) = remainder.split_at(remainder.floor_char_boundary(width));
53165318 new_lines.push(Cow::from(first));
53175319 remainder = second;
53185320 }